genetlink: Fix a memory leak on error path
commitbd60a788b10b6b10cc7d53a41a8a53a300705690
authorYueHaibing <yuehaibing@huawei.com>
Thu, 21 Mar 2019 07:02:50 +0000 (21 15:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2019 04:27:22 +0000 (3 06:27 +0200)
treea48bdd0b337ae561019a6e6d16e671d6005cdf0f
parent3b58f24bdfec7d0297da4c304107364d95271607
genetlink: Fix a memory leak on error path

[ Upstream commit ceabee6c59943bdd5e1da1a6a20dc7ee5f8113a2 ]

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

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 2ae0f17df1cd ("genetlink: use idr to track families")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netlink/genetlink.c