From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Ying Xue <ying.xue@windriver.com>, davem@davemloft.net
Cc: vfalico@redhat.com, john.r.fastabend@intel.com,
stephen@networkplumber.org, antonio@meshcoding.com,
dmitry.tarnyagin@lockless.no, johannes@sipsolutions.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 09/10] can: use __dev_get_by_index instead of dev_get_by_index to find interface
Date: Tue, 14 Jan 2014 17:11:26 +0100 [thread overview]
Message-ID: <52D561AE.1020103@hartkopp.net> (raw)
In-Reply-To: <1389685269-18600-10-git-send-email-ying.xue@windriver.com>
On 14.01.2014 08:41, Ying Xue wrote:
> As cgw_create_job() is always under rtnl_lock protection,
> __dev_get_by_index() instead of dev_get_by_index() should be used to
> find interface handler in it having us avoid to change interface
> reference counter.
>
> Cc: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Ying Xue <ying.xue@windriver.com>
Thanks for the simplification!
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> ---
> net/can/gw.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/net/can/gw.c b/net/can/gw.c
> index 88c8a39..ac31891 100644
> --- a/net/can/gw.c
> +++ b/net/can/gw.c
> @@ -839,21 +839,21 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
> if (!gwj->ccgw.src_idx || !gwj->ccgw.dst_idx)
> goto out;
>
> - gwj->src.dev = dev_get_by_index(&init_net, gwj->ccgw.src_idx);
> + gwj->src.dev = __dev_get_by_index(&init_net, gwj->ccgw.src_idx);
>
> if (!gwj->src.dev)
> goto out;
>
> if (gwj->src.dev->type != ARPHRD_CAN)
> - goto put_src_out;
> + goto out;
>
> - gwj->dst.dev = dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
> + gwj->dst.dev = __dev_get_by_index(&init_net, gwj->ccgw.dst_idx);
>
> if (!gwj->dst.dev)
> - goto put_src_out;
> + goto out;
>
> if (gwj->dst.dev->type != ARPHRD_CAN)
> - goto put_src_dst_out;
> + goto out;
>
> gwj->limit_hops = limhops;
>
> @@ -862,11 +862,6 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh)
> err = cgw_register_filter(gwj);
> if (!err)
> hlist_add_head_rcu(&gwj->list, &cgw_list);
> -
> -put_src_dst_out:
> - dev_put(gwj->dst.dev);
> -put_src_out:
> - dev_put(gwj->src.dev);
> out:
> if (err)
> kmem_cache_free(cgw_cache, gwj);
>
next prev parent reply other threads:[~2014-01-14 16:17 UTC|newest]
Thread overview: 18+ 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 ` [B.A.T.M.A.N.] " Antonio Quartulli
2014-01-14 12:43 ` Antonio Quartulli
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 [this message]
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=52D561AE.1020103@hartkopp.net \
--to=socketcan@hartkopp.net \
--cc=antonio@meshcoding.com \
--cc=davem@davemloft.net \
--cc=dmitry.tarnyagin@lockless.no \
--cc=johannes@sipsolutions.net \
--cc=john.r.fastabend@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.