netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: ehakim@nvidia.com
Cc: netdev@vger.kernel.org, raeds@nvidia.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	atenart@kernel.org
Subject: Re: [PATCH net-next v6 1/2] macsec: add support for IFLA_MACSEC_OFFLOAD in macsec_changelink
Date: Sun, 8 Jan 2023 00:04:36 +0100	[thread overview]
Message-ID: <Y7n6hF3voEe8Hv+5@hog> (raw)
In-Reply-To: <20230106133551.31940-2-ehakim@nvidia.com>

2023-01-06, 15:35:50 +0200, ehakim@nvidia.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.

> +
> +	ret = macsec_update_offload(dev, offload);
>  
> -rollback:
> -	macsec->offload = prev_offload;
> -out:
>  	rtnl_unlock();
> +
>  	return ret;
>  }
>  

-- 
Sabrina


  reply	other threads:[~2023-01-07 23:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 13:35 [PATCH net-next v6 0/2] Add support to offload macsec using netlink update ehakim
2023-01-06 13:35 ` [PATCH net-next v6 1/2] macsec: add support for IFLA_MACSEC_OFFLOAD in macsec_changelink ehakim
2023-01-07 23:04   ` Sabrina Dubroca [this message]
2023-01-08  9:46     ` Emeel Hakim
2023-01-06 13:35 ` [PATCH net-next v6 2/2] macsec: dump IFLA_MACSEC_OFFLOAD attribute as part of macsec dump ehakim
  -- strict thread matches above, loose matches on Subject: below --
2023-01-05  8:04 [PATCH net-next 0/2] Add support to offload macsec using netlink update ehakim
2023-01-05  8:04 ` [PATCH net-next v6 1/2] macsec: add support for IFLA_MACSEC_OFFLOAD in macsec_changelink ehakim
2023-01-05  7:57 [PATCH net-next v6 0/2] Add support to offload macsec using netlink update ehakim
2023-01-05  7:57 ` [PATCH net-next v6 1/2] macsec: add support for IFLA_MACSEC_OFFLOAD in macsec_changelink ehakim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y7n6hF3voEe8Hv+5@hog \
    --to=sd@queasysnail.net \
    --cc=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ehakim@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=raeds@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).