lkml.org 
[lkml]   [2024]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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) {
\
 
 \ /
  Last update: 2024-05-27 15:24    [W:0.072 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site