]> git.baikalelectronics.ru Git - kernel.git/commit
genetlink: fix a memory leak on error path
authorWANG Cong <xiyou.wangcong@gmail.com>
Thu, 3 Nov 2016 16:42:35 +0000 (09:42 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 Nov 2016 20:52:29 +0000 (16:52 -0400)
commit3fb7b5783fab2c49db4c87774891e74d5cbd3385
treec21c7a5a82b60085cd8b987d983c78a2443ecb05
parent5b08401d7f75da6556140aa25e240216de0b16e6
genetlink: fix a memory leak on error path

In __genl_register_family(), when genl_validate_assign_mc_groups()
fails, we forget to free the memory we possibly allocate for
family->attrbuf.

Note, some callers call genl_unregister_family() to clean up
on error path, it doesn't work because the family is inserted
to the global list in the nearly last step.

Cc: Jakub Kicinski <kubakici@wp.pl>
Cc: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c