net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report
authorPedro Tammela <pctammela@mojatatu.com>
Mon, 29 May 2023 15:33:35 +0000 (12:33 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jun 2023 08:34:03 +0000 (10:34 +0200)
commit507182f132a8cb568d33f0fdda0a164f78d8d376
tree34c8eaca9ac77561172401cd0b42f7145cadabd7
parent5c05ef3630cace3fe2b7964674faeb040ccb768c
net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report

[ Upstream commit f4e4534850a9d18c250a93f8d7fbb51310828110 ]

The current code for the length calculation wrongly truncates the reported
length of the groups array, causing an under report of the subscribed
groups. To fix this, use 'BITS_TO_BYTES()' which rounds up the
division by 8.

Fixes: b42be38b2778 ("netlink: add API to retrieve all group memberships")
Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230529153335.389815-1-pctammela@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netlink/af_netlink.c