netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: subashab@codeaurora.org
Cc: netdev@vger.kernel.org, fengguang.wu@intel.com, dcbw@redhat.com,
	jiri@resnulli.us, stephen@networkplumber.org,
	David.Laight@ACULAB.COM, marcel@holtmann.org, andrew@lunn.ch
Subject: Re: [PATCH net-next 3/3 v9] drivers: net: ethernet: qualcomm: rmnet: Initial implementation
Date: Fri, 25 Aug 2017 20:06:23 -0700 (PDT)	[thread overview]
Message-ID: <20170825.200623.1467784779129980276.davem@davemloft.net> (raw)
In-Reply-To: <1503635966-14076-4-git-send-email-subashab@codeaurora.org>

From: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Date: Thu, 24 Aug 2017 22:39:26 -0600

> +static void rmnet_force_unassociate_device(struct net_device *dev)
> +{
> +	struct net_device *real_dev = dev;
> +	struct rmnet_walk_data d;
> +	LIST_HEAD(list);
> +
> +	if (!rmnet_is_real_dev_registered(real_dev))
> +		return;
> +
> +	ASSERT_RTNL();
> +
> +	d.real_dev = real_dev;
> +	d.head = &list;
> +
> +	rcu_read_lock();
> +	netdev_walk_all_lower_dev_rcu(real_dev, rmnet_dev_walk_unreg, &d);
> +	synchronize_net();
> +
> +	unregister_netdevice_many(&list);
> +	rcu_read_unlock();
> +
> +	rmnet_unregister_real_device(real_dev);
> +}

In these code paths where you are the writer, you have to rely upon
the RTNL mutex (or some other mutual exclusion mechanism) to protect
the update operation.  RCU locking itself does not provide this.

So you should use something like rcu_dereference_rtnl() or similar.

So this would be rmnet_force_unassociate_device() and rmnet_dellink()

RCU is subtle and the writer paths have the be handled differently
from the reader paths.  Please take some time to study how RCU should
be applied properly in these situations rather than just slapping a
patch together overnight.

Thank you.

  reply	other threads:[~2017-08-26  3:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  4:39 [PATCH net-next 0/3 v9] Add support for rmnet driver Subash Abhinov Kasiviswanathan
2017-08-25  4:39 ` [PATCH net-next 1/3 v9] net: ether: Add support for multiplexing and aggregation type Subash Abhinov Kasiviswanathan
2017-08-28 22:22   ` Dan Williams
2017-08-29  3:00     ` Subash Abhinov Kasiviswanathan
2017-08-25  4:39 ` [PATCH net-next 2/3 v9] net: arp: Add support for raw IP device Subash Abhinov Kasiviswanathan
2017-08-25  4:39 ` [PATCH net-next 3/3 v9] drivers: net: ethernet: qualcomm: rmnet: Initial implementation Subash Abhinov Kasiviswanathan
2017-08-26  3:06   ` David Miller [this message]
2017-08-28 17:40     ` Subash Abhinov Kasiviswanathan

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=20170825.200623.1467784779129980276.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=andrew@lunn.ch \
    --cc=dcbw@redhat.com \
    --cc=fengguang.wu@intel.com \
    --cc=jiri@resnulli.us \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=subashab@codeaurora.org \
    /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).