]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - net/netlink/af_netlink.c
netlink: Don't shift on 64 for ngroups
[mirror_ubuntu-bionic-kernel.git] / net / netlink / af_netlink.c
index 07e61faaea479f0100d8e0f247c32f72d6cbdf0a..6db2daedf01c059efdc241af254afb3b77ae4bd4 100644 (file)
@@ -980,8 +980,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
 
        if (nlk->ngroups == 0)
                groups = 0;
-       else
-               groups &= (1ULL << nlk->ngroups) - 1;
+       else if (nlk->ngroups < 8*sizeof(groups))
+               groups &= (1UL << nlk->ngroups) - 1;
 
        bound = nlk->bound;
        if (bound) {