netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@meshcoding.com>
To: Ying Xue <ying.xue@windriver.com>, davem@davemloft.net
Cc: vfalico@redhat.com, john.r.fastabend@intel.com,
	stephen@networkplumber.org, dmitry.tarnyagin@lockless.no,
	socketcan@hartkopp.net, johannes@sipsolutions.net,
	netdev@vger.kernel.org,
	The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [PATCH net-next 07/10] batman-adv: use __dev_get_by_index instead of dev_get_by_index to find interface
Date: Tue, 14 Jan 2014 13:43:02 +0100	[thread overview]
Message-ID: <52D530D6.3040004@meshcoding.com> (raw)
In-Reply-To: <1389685269-18600-8-git-send-email-ying.xue@windriver.com>

[-- Attachment #1: Type: text/plain, Size: 1624 bytes --]

On 14/01/14 08:41, Ying Xue wrote:
> The following call chains indicate that batadv_is_on_batman_iface()
> is always under rtnl_lock protection as call_netdevice_notifier()
> is protected by rtnl_lock. So if __dev_get_by_index() rather than
> dev_get_by_index() is used to find interface handler in it, this
> would help us avoid to change interface reference counter.
> 
> call_netdevice_notifier()
>   batadv_hard_if_event()
>     batadv_hardif_add_interface()
>       batadv_is_valid_iface()
>         batadv_is_on_batman_iface()
> 
> Cc: Antonio Quartulli <antonio@meshcoding.com>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>

Acked-by: Antonio Quartulli <antonio@meshcoding.com>


> ---
>  net/batman-adv/hard-interface.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
> index bebd46c..115d14e 100644
> --- a/net/batman-adv/hard-interface.c
> +++ b/net/batman-adv/hard-interface.c
> @@ -86,15 +86,13 @@ static bool batadv_is_on_batman_iface(const struct net_device *net_dev)
>  		return false;
>  
>  	/* recurse over the parent device */
> -	parent_dev = dev_get_by_index(&init_net, net_dev->iflink);
> +	parent_dev = __dev_get_by_index(&init_net, net_dev->iflink);
>  	/* if we got a NULL parent_dev there is something broken.. */
>  	if (WARN(!parent_dev, "Cannot find parent device"))
>  		return false;
>  
>  	ret = batadv_is_on_batman_iface(parent_dev);
>  
> -	if (parent_dev)
> -		dev_put(parent_dev);
>  	return ret;
>  }
>  
> 


-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-01-14 12:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  7:40 [PATCH net-next 00/10] use appropriate APIs to get interfaces Ying Xue
2014-01-14  7:41 ` [PATCH net-next 01/10] Drivers: Staging: cxt1e1: use __dev_get_name instead of dev_get_name to find interfaces Ying Xue
2014-01-14  7:41 ` [PATCH net-next 02/10] bonding: use __dev_get_by_name instead of dev_get_by_name to find interface Ying Xue
2014-01-14 11:55   ` Veaceslav Falico
2014-01-14  7:41 ` [PATCH net-next 03/10] eql: " Ying Xue
2014-01-14  7:41 ` [PATCH net-next 04/10] dcb: " Ying Xue
2014-01-14  7:41 ` [PATCH net-next 05/10] decnet: use __dev_get_by_index instead of dev_get_by_index " Ying Xue
2014-01-14  7:41 ` [PATCH net-next 06/10] vxlan: " Ying Xue
2014-01-14 16:51   ` Stephen Hemminger
2014-01-14  7:41 ` [PATCH net-next 07/10] batman-adv: " Ying Xue
2014-01-14 12:43   ` Antonio Quartulli [this message]
2014-01-14  7:41 ` [PATCH net-next 08/10] caif: " Ying Xue
2014-01-14  7:41 ` [PATCH net-next 09/10] can: use " Ying Xue
2014-01-14 16:11   ` Oliver Hartkopp
2014-01-14  7:41 ` [PATCH net-next 10/10] net: nl80211: " Ying Xue
2014-01-14 12:11   ` Johannes Berg
2014-01-15  1:18     ` Ying Xue

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=52D530D6.3040004@meshcoding.com \
    --to=antonio@meshcoding.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=dmitry.tarnyagin@lockless.no \
    --cc=johannes@sipsolutions.net \
    --cc=john.r.fastabend@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=stephen@networkplumber.org \
    --cc=vfalico@redhat.com \
    --cc=ying.xue@windriver.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).