Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1199799
| Path | csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Philipp Reisner <philipp.reisner@linbit.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 13/19] drbd: fix memory leak in drbd_adm_resize |
| Date | Tue, 04 Aug 2015 15:00:04 +0200 |
| Message-ID | <pTJZ2-2yz-39@gated-at.bofh.it> (permalink) |
| References | <pTJZ0-2yz-9@gated-at.bofh.it> |
| X-Original-To | linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk> |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 42 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | drbd-dev@lists.linbit.com |
| X-Original-Date | Tue, 4 Aug 2015 14:56:37 +0200 |
| X-Original-Message-ID | <1438693003-17554-14-git-send-email-philipp.reisner@linbit.com> |
| X-Original-References | <1438693003-17554-1-git-send-email-philipp.reisner@linbit.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1199799 |
Show key headers only | View raw
From: Oleg Drokin <green@linuxhacker.ru> 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> --- drivers/block/drbd/drbd_nl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 3925f8e..1d42c4f 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -2705,6 +2705,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); @@ -2738,6 +2739,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) fail_ldev: put_ldev(device); + kfree(new_disk_conf); goto fail; } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 13/19] drbd: fix memory leak in drbd_adm_resize Philipp Reisner <philipp.reisner@linbit.com> - 2015-08-04 15:00 +0200
csiph-web