Patch "net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-netlink-fix-netlink_list_memberships-length-repo.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1d394d4e9103cc5e383f561117896c2ef3b54c41
Author: Pedro Tammela <pctammela@xxxxxxxxxxxx>
Date:   Mon May 29 12:33:35 2023 -0300

    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@xxxxxxxxxxxx>
    Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230529153335.389815-1-pctammela@xxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d1b19618890b7..6d493a0ccf399 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1768,7 +1768,7 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,
 				break;
 			}
 		}
-		if (put_user(ALIGN(nlk->ngroups / 8, sizeof(u32)), optlen))
+		if (put_user(ALIGN(BITS_TO_BYTES(nlk->ngroups), sizeof(u32)), optlen))
 			err = -EFAULT;
 		netlink_unlock_table();
 		return err;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux