mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
tipc: fix memory leak in tipc_nl_compat_publ_dump
[ Upstream commitf87d8ad923] There is a memory leak in case genlmsg_put fails. Fix this by freeing *args* before return. Addresses-Coverity-ID: 1476406 ("Resource leak") Fixes:46273cf7e0("tipc: fix a missing check of genlmsg_put") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Ying Xue <ying.xue@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d63d0816c2
commit
ec5676b5fe
@@ -974,8 +974,10 @@ static int tipc_nl_compat_publ_dump(struct tipc_nl_compat_msg *msg, u32 sock)
|
||||
|
||||
hdr = genlmsg_put(args, 0, 0, &tipc_genl_family, NLM_F_MULTI,
|
||||
TIPC_NL_PUBL_GET);
|
||||
if (!hdr)
|
||||
if (!hdr) {
|
||||
kfree_skb(args);
|
||||
return -EMSGSIZE;
|
||||
}
|
||||
|
||||
nest = nla_nest_start(args, TIPC_NLA_SOCK);
|
||||
if (!nest) {
|
||||
|
||||
Reference in New Issue
Block a user