[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <IA1PR12MB6353B1E92F98FEC8B1B04F8EABF99@IA1PR12MB6353.namprd12.prod.outlook.com>
Date: Sun, 8 Jan 2023 09:46:26 +0000
From: Emeel Hakim <ehakim@...dia.com>
To: Sabrina Dubroca <sd@...asysnail.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Raed Salem <raeds@...dia.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"atenart@...nel.org" <atenart@...nel.org>
Subject: RE: [PATCH net-next v6 1/2] macsec: add support for
IFLA_MACSEC_OFFLOAD in macsec_changelink
> -----Original Message-----
> From: Sabrina Dubroca <sd@...asysnail.net>
> Sent: Sunday, 8 January 2023 1:05
> To: Emeel Hakim <ehakim@...dia.com>
> Cc: netdev@...r.kernel.org; Raed Salem <raeds@...dia.com>;
> davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org;
> pabeni@...hat.com; atenart@...nel.org
> Subject: Re: [PATCH net-next v6 1/2] macsec: add support for
> IFLA_MACSEC_OFFLOAD in macsec_changelink
>
> External email: Use caution opening links or attachments
>
>
> 2023-01-06, 15:35:50 +0200, ehakim@...dia.com wrote:
> [...]
> > +static int macsec_upd_offload(struct sk_buff *skb, struct genl_info
> > +*info) {
> > + struct nlattr *tb_offload[MACSEC_OFFLOAD_ATTR_MAX + 1];
> > + struct nlattr **attrs = info->attrs;
> > + enum macsec_offload offload;
> > + struct net_device *dev;
> > + int ret;
> > +
> > + if (!attrs[MACSEC_ATTR_IFINDEX])
> > + return -EINVAL;
> > +
> > + if (!attrs[MACSEC_ATTR_OFFLOAD])
> > + return -EINVAL;
> > +
> > + if (nla_parse_nested_deprecated(tb_offload, MACSEC_OFFLOAD_ATTR_MAX,
> > + attrs[MACSEC_ATTR_OFFLOAD],
> > + macsec_genl_offload_policy, NULL))
> > + return -EINVAL;
> > +
> > + dev = get_dev_from_nl(genl_info_net(info), attrs);
> > + if (IS_ERR(dev))
> > + return PTR_ERR(dev);
> > +
> > + if (!tb_offload[MACSEC_OFFLOAD_ATTR_TYPE])
> > + return -EINVAL;
> > +
> > + offload = nla_get_u8(tb_offload[MACSEC_OFFLOAD_ATTR_TYPE]);
> > +
> > + rtnl_lock();
>
> Why are you putting rtnl_lock() back down here? You just moved it above
> get_dev_from_nl with commit f3b4a00f0f62 ("net: macsec: fix net device access
> prior to holding a lock"), now you're pretty much reverting that fix.
Ack will fix.
> > +
> > + ret = macsec_update_offload(dev, offload);
> >
> > -rollback:
> > - macsec->offload = prev_offload;
> > -out:
> > rtnl_unlock();
> > +
> > return ret;
> > }
> >
>
> --
> Sabrina
Powered by blists - more mailing lists