mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiaolou4617@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: llc: add lock_sock in llc_ui_bind to avoid a race condition
Date: Fri, 26 May 2017 14:24:05 -0400 (EDT)	[thread overview]
Message-ID: <20170526.142405.1523981438362847832.davem@davemloft.net> (raw)
In-Reply-To: <1495692438-9781-1-git-send-email-xiaolou4617@gmail.com>

From: Lin Zhang <xiaolou4617@gmail.com>
Date: Thu, 25 May 2017 14:07:18 +0800

> There is a race condition in llc_ui_bind if two or more processes/threads 
> try to bind a same socket.
> 
> If more processes/threads bind a same socket success that will lead to 
> two problems, one is this action is not what we expected, another is 
> will lead to kernel in unstable status or oops(in my simple test case, 
> cause llc2.ko can't unload).
> 
> The current code is test SOCK_ZAPPED bit to avoid a process to 
> bind a same socket twice but that is can't avoid more processes/threads 
> try to bind a same socket at the same time.
> 
> So, add lock_sock in llc_ui_bind like others, such as llc_ui_connect.
> 
> Signed-off-by: Lin Zhang <xiaolou4617@gmail.com>

Applied, thank you.

      reply	other threads:[~2017-05-26 18:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25  6:07 Lin Zhang
2017-05-26 18:24 ` David Miller [this message]

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=20170526.142405.1523981438362847832.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=xiaolou4617@gmail.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

all inboxes | Powered by JetHome®