devlink: fix potential memort leak
We must free allocated skb when genlmsg_put() return fails.
Fixes: 1555d204e7
("devlink: Support for pipeline debug (dpipe)")
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1e0ce2a1ee
commit
6044bd4a7d
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue