Messages in this thread | | | Date | Tue, 27 Feb 2024 19:54:16 +0800 (GMT+08:00) | From | "Lin Ma" <> | Subject | Re: [PATCH net v1] rtnetlink: fix error logic of IFLA_BRIDGE_FLAGS writing back |
| |
Hello Nikolay,
> > That fix is obviously broken, I don't know how I missed it back then. > One comment below,
Guess is because this loop is so weird :( I looked into the kernel and did not find other codes that refer to the NLA pointer outside the `nla_for_each_nested` loop.
> ... > > struct net *net = sock_net(skb->sk); > > struct ifinfomsg *ifm; > > struct net_device *dev; > > - struct nlattr *br_spec, *attr = NULL; > > + struct nlattr *br_spec, *attr, *br_flag = NULL; > > Please name the variable to something that describes it better, like > br_flags_attr. >
OK, I will rename the variable and send another version.
> > int rem, err = -EOPNOTSUPP; > > u16 flags = 0; > > - bool have_flags = false; > > > > if (nlmsg_len(nlh) < sizeof(*ifm)) > > return -EINVAL; > > @@ -5190,11 +5189,11 @@ static int rtnl_bridge_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, > > br_spec = nlmsg_find_attr(nlh, sizeof(struct ifinfomsg), IFLA_AF_SPEC); > > if (br_spec) {
| |