aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorStefan Behrens <sbehrens@giantdisaster.de>2012-03-19 11:17:22 -0400
committerDavid Sterba <dsterba@suse.cz>2012-04-18 13:22:35 -0400
commit99ba55ad696944b37d5557bc5b4816890854fdb9 (patch)
tree2c8bf9a167f351b89ef86e2133ffec7dfb5d1ce7 /fs
parentb9688bb8459b67e42327de6420edb405a9188775 (diff)
Btrfs: fix btrfs_ioctl_dev_info() crash on missing device
When a filesystem is mounted with the degraded option, it is possible that some of the devices are not there. btrfs_ioctl_dev_info() crashs in this case because the device name is a NULL pointer. This ioctl was only used for scrub. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ioctl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 18cc23d164a8..14f8e1faa46e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -2262,7 +2262,10 @@ static long btrfs_ioctl_dev_info(struct btrfs_root *root, void __user *arg)
2262 di_args->bytes_used = dev->bytes_used; 2262 di_args->bytes_used = dev->bytes_used;
2263 di_args->total_bytes = dev->total_bytes; 2263 di_args->total_bytes = dev->total_bytes;
2264 memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid)); 2264 memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid));
2265 strncpy(di_args->path, dev->name, sizeof(di_args->path)); 2265 if (dev->name)
2266 strncpy(di_args->path, dev->name, sizeof(di_args->path));
2267 else
2268 di_args->path[0] = '\0';
2266 2269
2267out: 2270out:
2268 if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args))) 2271 if (ret == 0 && copy_to_user(arg, di_args, sizeof(*di_args)))