* Re: [B.A.T.M.A.N.] [PATCH net-next 07/10] batman-adv: use __dev_get_by_index instead of dev_get_by_index to find interface
[not found] ` <1389685269-18600-8-git-send-email-ying.xue@windriver.com>
@ 2014-01-14 12:43 ` Antonio Quartulli
0 siblings, 0 replies; only message in thread
From: Antonio Quartulli @ 2014-01-14 12:43 UTC (permalink / raw)
To: Ying Xue, davem
Cc: vfalico, stephen, dmitry.tarnyagin, socketcan,
The list for a Better Approach To Mobile Ad-hoc Networking,
john.r.fastabend, netdev, johannes
[-- 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 --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-01-14 12:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1389685269-18600-1-git-send-email-ying.xue@windriver.com>
[not found] ` <1389685269-18600-8-git-send-email-ying.xue@windriver.com>
2014-01-14 12:43 ` [B.A.T.M.A.N.] [PATCH net-next 07/10] batman-adv: use __dev_get_by_index instead of dev_get_by_index to find interface Antonio Quartulli
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).