Re: [PATCH] btrfs: oops in device_list_add()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 27.01.19 г. 6:58 ч., Al Viro wrote:
> 	alloc_fs_devices() can return ERR_PTR(-ENOMEM), so
> dereferencing its result before the check for IS_ERR() is
> a bad idea...
> 
> Fixes: d1a63002829a4
> Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>

Thought this was already fixed, doh...

Reviewed-by: Nikolay Borisov <nborisov@xxxxxxxx>

> ---
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index 85149f27644d..72adc5643bde 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -955,11 +955,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
>  		else
>  			fs_devices = alloc_fs_devices(disk_super->fsid, NULL);
>  
> -		fs_devices->fsid_change = fsid_change_in_progress;
> -
>  		if (IS_ERR(fs_devices))
>  			return ERR_CAST(fs_devices);
>  
> +		fs_devices->fsid_change = fsid_change_in_progress;
> +
>  		mutex_lock(&fs_devices->device_list_mutex);
>  		list_add(&fs_devices->fs_list, &fs_uuids);
>  
> 



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux