]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: kfree()ing ERR_PTRs
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 4 Sep 2014 11:09:15 +0000 (14:09 +0300)
committerChris Mason <clm@fb.com>
Mon, 8 Sep 2014 20:56:42 +0000 (13:56 -0700)
commit84890fde7b01a46fd9d24cf82497ba65cbd1d032
treec53ea33e0067560a26f0122b0b606cc5743b8acc
parent04164489353ebe544a0025573a5658055f71c929
Btrfs: kfree()ing ERR_PTRs

The "inherit" in btrfs_ioctl_snap_create_v2() and "vol_args" in
btrfs_ioctl_rm_dev() are ERR_PTRs so we can't call kfree() on them.

These kind of bugs are "One Err Bugs" where there is just one error
label that does everything.  I could set the "inherit = NULL" and keep
the single out label but it ends up being more complicated that way.  It
makes the code simpler to re-order the unwind so it's in the mirror
order of the allocation and introduce some new error labels.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ioctl.c