diff mbox

fs/btrfs: Avoid possible NULL pointer dereference for fs_devices

Message ID 1270689844-8404-1-git-send-email-harsha@gluster.com (mailing list archive)
State New, archived
Headers show

Commit Message

R Harshavardhana April 8, 2010, 1:24 a.m. UTC
None
diff mbox

Patch

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);