* [PATCH v2] devlink: fix potential memort leak
@ 2017-06-05 0:57 Haishuang Yan
2017-06-05 4:51 ` Jiri Pirko
2017-06-05 15:28 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Haishuang Yan @ 2017-06-05 0:57 UTC (permalink / raw)
To: David S. Miller, Arkadi Sharshevsky, Jiri Pirko
Cc: netdev, linux-kernel, Haishuang Yan
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>
---
Changes in v2:
- Fix same issue in headers_fill.
---
net/core/devlink.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/core/devlink.c b/net/core/devlink.c
index b0b87a2..a0adfc3 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;
@@ -2098,8 +2100,10 @@ static int devlink_dpipe_headers_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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] devlink: fix potential memort leak
2017-06-05 0:57 [PATCH v2] devlink: fix potential memort leak Haishuang Yan
@ 2017-06-05 4:51 ` Jiri Pirko
2017-06-05 15:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2017-06-05 4:51 UTC (permalink / raw)
To: Haishuang Yan
Cc: David S. Miller, Arkadi Sharshevsky, Jiri Pirko, netdev, linux-kernel
Mon, Jun 05, 2017 at 02:57:21AM CEST, yanhaishuang@cmss.chinamobile.com wrote:
>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>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] devlink: fix potential memort leak
2017-06-05 0:57 [PATCH v2] devlink: fix potential memort leak Haishuang Yan
2017-06-05 4:51 ` Jiri Pirko
@ 2017-06-05 15:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-06-05 15:28 UTC (permalink / raw)
To: yanhaishuang; +Cc: arkadis, jiri, netdev, linux-kernel
From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Date: Mon, 5 Jun 2017 08:57:21 +0800
> 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>
>
> ---
> Changes in v2:
> - Fix same issue in headers_fill.
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-05 15:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-05 0:57 [PATCH v2] devlink: fix potential memort leak Haishuang Yan
2017-06-05 4:51 ` Jiri Pirko
2017-06-05 15:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).