From: Ying Xue <ying.xue@windriver.com>
To: Herbert Xu <herbert@gondor.apana.org.au>, <netdev@vger.kernel.org>
Subject: Re: netlink: Fix netlink_insert EADDRINUSE error
Date: Fri, 16 Jan 2015 14:30:33 +0800 [thread overview]
Message-ID: <54B8B009.6020207@windriver.com> (raw)
In-Reply-To: <20150116062348.GA8588@gondor.apana.org.au>
On 01/16/2015 02:23 PM, Herbert Xu wrote:
> The patch c5adde9468b0714a051eac7f9666f23eb10b61f7 ("netlink:
> eliminate nl_sk_hash_lock") introduced a bug where the EADDRINUSE
> error has been replaced by ENOMEM. This patch rectifies that
> problem.
>
Nice catch!
Acked-by: Ying Xue <ying.xue@windriver.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 01b702d..7a94185 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -1050,7 +1050,7 @@ netlink_update_listeners(struct sock *sk)
> static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
> {
> struct netlink_table *table = &nl_table[sk->sk_protocol];
> - int err = -EADDRINUSE;
> + int err;
>
> lock_sock(sk);
>
> @@ -1065,10 +1065,13 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 portid)
>
> nlk_sk(sk)->portid = portid;
> sock_hold(sk);
> - if (__netlink_insert(table, sk, net))
> - err = 0;
> - else
> +
> + err = 0;
> + if (!__netlink_insert(table, sk, net)) {
> + err = -EADDRINUSE;
> sock_put(sk);
> + }
> +
> err:
> release_sock(sk);
> return err;
>
next prev parent reply other threads:[~2015-01-16 6:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-16 6:23 netlink: Fix netlink_insert EADDRINUSE error Herbert Xu
2015-01-16 6:30 ` Ying Xue [this message]
2015-01-16 7:38 ` David Miller
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=54B8B009.6020207@windriver.com \
--to=ying.xue@windriver.com \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.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).