]> git.baikalelectronics.ru Git - kernel.git/commit
genetlink: clean up family attributes allocations
authorCong Wang <xiyou.wangcong@gmail.com>
Fri, 12 Jun 2020 07:16:55 +0000 (00:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jun 2020 21:05:08 +0000 (14:05 -0700)
commitaa95801e410fe07b70e392d8a4af5a33eabaa917
tree8a3a04539dbdafe4336223edb3b5da5684efdf77
parentf7e2fdb0e6e0eb0660789278e4cff7f0334cb311
genetlink: clean up family attributes allocations

genl_family_rcv_msg_attrs_parse() and genl_family_rcv_msg_attrs_free()
take a boolean parameter to determine whether allocate/free the family
attrs. This is unnecessary as we can just check family->parallel_ops.
More importantly, callers would not need to worry about pairing these
parameters correctly after this patch.

And this fixes a memory leak, as after commit d975c14e3ea9
("genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()")
we call genl_family_rcv_msg_attrs_parse() for both parallel and
non-parallel cases.

Fixes: d975c14e3ea9 ("genetlink: fix memory leaks in genl_family_rcv_msg_dumpit()")
Reported-by: Ido Schimmel <idosch@idosch.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Tested-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/genetlink.c