Subject: Re: [PATCH 4.4 106/124] netlink: Do not subscribe to non-existent groups

From: Nathan Chancellor <[email-masked]>
Date: Sat, 4 Aug 2018 15:49:56 -0700

On Sat, Aug 04, 2018 at 11:33:27PM +0100, Dmitry Safonov wrote:
> On Sat, 2018-08-04 at 11:07 -0700, Nathan Chancellor wrote:
> > Hi Greg,
> 
> Hi Nathan,
> 
> > I am so sorry I didn't catch this in my initial report but this
> > commit
> > along with ba7aaf93ef2f ("netlink: Don't shift with UB on nlk-
> > >ngroups")
> > breaks mobile data on both the Pixel 2 XL and OnePlus 6. There is
> > signal
> > but it just never connects to 3G/LTE. Reverting those two commits
> > fixes
> > the issue.
> 
> Sorry for breaking your use-case,
> 

No apologies necessary, thank you for the quick response!

> > Nothing stands out to me in dmesg unfortunately and iven neither
> > device
> > is running a vanilla kernel, I cannot say if this is a problem in
> > mainline
> > or not but I just wanted to make you aware of it.
> 
> Could you provide the dmesg output for the attached debug diff?

dmesg output attached, please let me know if you need anything else.

> -- 
> Thanks,
>              Dmitry

> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 7d860a22e5fb..0cddc35e1e87 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1009,10 +1009,14 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
>  			return err;
>  	}
>  
> -	if (nlk->ngroups == 0)
> +	if (nlk->ngroups == 0) {
>  		groups = 0;
> -	else
> +	} else {
> +		if (groups != (groups & ((1ULL << nlk->ngroups) - 1)))
> +			pr_alert("%s: groups: %#lx ngroups: %u\n",
> +				current->comm, groups, nlk->ngroups);
>  		groups &= (1ULL << nlk->ngroups) - 1;
> +	}
>  
>  	bound = nlk->bound;
>  	if (bound) {

Cheers!
Nathan