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

From: Dmitry Safonov
Date: Sat Aug 04 2018 - 18:33:36 EST


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,

> 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?

--
Thanks,
Dmitrydiff --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) {