Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1657063 > unrolled thread

[PATCH] devlink: fix potential memort leak

Started byHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
First post2017-06-04 15:00 +0200
Last post2017-06-04 15:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] devlink: fix potential memort leak Haishuang Yan <yanhaishuang@cmss.chinamobile.com> - 2017-06-04 15:00 +0200

#1657063 — [PATCH] devlink: fix potential memort leak

FromHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Date2017-06-04 15:00 +0200
Subject[PATCH] devlink: fix potential memort leak
Message-ID<tODip-5cy-1@gated-at.bofh.it>
We must free allocated skb when genlmsg_put() return fails.

Fixes: 1555d204e743 ("devlink: Support for pipeline debug (dpipe)")
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
 net/core/devlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index b0b87a2..70b69c6 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -1680,8 +1680,10 @@ static int devlink_dpipe_tables_fill(struct genl_info *info,
 
 	hdr = genlmsg_put(skb, info->snd_portid, info->snd_seq,
 			  &devlink_nl_family, NLM_F_MULTI, cmd);
-	if (!hdr)
+	if (!hdr) {
+		nlmsg_free(skb);
 		return -EMSGSIZE;
+	}
 
 	if (devlink_nl_put_handle(skb, devlink))
 		goto nla_put_failure;
-- 
1.8.3.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web