From patchwork Thu Apr 8 01:24:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: R Harshavardhana X-Patchwork-Id: 91206 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o381OEiu009767 for ; Thu, 8 Apr 2010 01:24:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758252Ab0DHBYK (ORCPT ); Wed, 7 Apr 2010 21:24:10 -0400 Received: from zp3.zcs.datasyncintra.net ([208.88.241.29]:5143 "EHLO zp3.zcs.datasyncintra.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752954Ab0DHBYJ (ORCPT ); Wed, 7 Apr 2010 21:24:09 -0400 Received: from localhost (localhost [127.0.0.1]) by zp3.zcs.datasyncintra.net (Postfix) with ESMTP id DDCE32071 for ; Wed, 7 Apr 2010 20:24:08 -0500 (CDT) X-Virus-Scanned: amavisd-new at zp3.zcs.datasyncintra.net Received: from zp3.zcs.datasyncintra.net ([127.0.0.1]) by localhost (zp3.zcs.datasyncintra.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ftLUz2gxqvdw for ; Wed, 7 Apr 2010 20:24:08 -0500 (CDT) Received: from localhost.localdomain (adsl-99-160-131-163.dsl.pltn13.sbcglobal.net [99.160.131.163]) (Authenticated sender: harsha@gluster.com) by zp3.zcs.datasyncintra.net (Postfix) with ESMTPSA id EAC7B2066 for ; Wed, 7 Apr 2010 20:24:07 -0500 (CDT) From: Harshavardhana To: linux-btrfs@vger.kernel.org Subject: [PATCH] fs/btrfs: Avoid possible NULL pointer dereference for fs_devices Date: Wed, 7 Apr 2010 18:24:04 -0700 Message-Id: <1270689844-8404-1-git-send-email-harsha@gluster.com> X-Mailer: git-send-email 1.6.6.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 08 Apr 2010 01:24:14 +0000 (UTC) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index b584e9a..e3d2e6b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1261,7 +1261,8 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) break; fs_devices = fs_devices->seed; } - fs_devices->seed = device->fs_devices->seed; + if (fs_devices) + fs_devices->seed = device->fs_devices->seed; device->fs_devices->seed = NULL; __btrfs_close_devices(device->fs_devices); free_fs_devices(device->fs_devices);