summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOleg Drokin <green@linuxhacker.ru>2015-04-26 07:28:43 +0200
committerJens Axboe <axboe@fb.com>2015-11-25 17:22:03 +0100
commit706447861bb210cf2fb6a58bc1d29a6636175987 (patch)
treeb81c71120e9589293608495d1236752d76209023 /drivers
parentdrbd: don't block forever in disconnect during resync if fencing=r-a-stonith (diff)
downloadlinux-706447861bb210cf2fb6a58bc1d29a6636175987.tar.xz
linux-706447861bb210cf2fb6a58bc1d29a6636175987.zip
drbd: fix memory leak in drbd_adm_resize
new_disk_conf could be leaked if the follow on checks fail, so make sure to free it on error if it was not assigned yet. Found with smatch. Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/drbd/drbd_nl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index ee34739ee9ff..613778994b23 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2706,6 +2706,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info)
mutex_unlock(&device->resource->conf_update);
synchronize_rcu();
kfree(old_disk_conf);
+ new_disk_conf = NULL;
}
ddsf = (rs.resize_force ? DDSF_FORCED : 0) | (rs.no_resync ? DDSF_NO_RESYNC : 0);
@@ -2739,6 +2740,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info)
fail_ldev:
put_ldev(device);
+ kfree(new_disk_conf);
goto fail;
}