netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ebiederm@xmission.com
Cc: herbert@gondor.apana.org.au, paul.moore@hp.com, netdev@vger.kernel.org
Subject: Re: [RFC PATCH v1] tun: Cleanup error handling in tun_set_iff()
Date: Sun, 09 Aug 2009 21:52:46 -0700 (PDT)	[thread overview]
Message-ID: <20090809.215246.48399343.davem@davemloft.net> (raw)
In-Reply-To: <m1k51gqmlp.fsf@fess.ebiederm.org>

From: ebiederm@xmission.com (Eric W. Biederman)
Date: Thu, 06 Aug 2009 21:22:42 -0700

> David Miller <davem@davemloft.net> writes:
> 
>> From: Herbert Xu <herbert@gondor.apana.org.au>
>> Date: Fri, 7 Aug 2009 10:22:44 +1000
>>
>>> tun: Extend RTNL lock coverage over whole ioctl
>>> 
>>> As it is, parts of the ioctl runs under the RTNL and parts of
>>> it do not.  The unlocked section is still protected by the BKL,
>>> but there can be subtle races.  For example, Eric Biederman and
>>> Paul Moore observed that if two threads tried to create two tun
>>> devices on the same file descriptor, then unexpected results
>>> may occur.
>>> 
>>> As there isn't anything in the ioctl that is expected to sleep
>>> indefinitely, we can prevent this from occurring by extending
>>> the RTNL lock coverage.
>>> 
>>> This also allows to get rid of the BKL.
>>> 
>>> Finally, I changed tun_get_iff to take a tun device in order to
>>> avoid calling tun_put which would dead-lockt as it also tries to
>>> take the RTNL lock.
>>> 
>>> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>>
>> This looks good after a quick audit, Eric what say you?
> 
> Looks good to me.

Applied, thanks everyone.

      reply	other threads:[~2009-08-10  4:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 16:12 [RFC PATCH v1] tun: Cleanup error handling in tun_set_iff() Paul Moore
2009-08-04  4:16 ` David Miller
2009-08-05  5:32 ` Eric W. Biederman
2009-08-05 21:38   ` Paul Moore
2009-08-05 23:14     ` Eric W. Biederman
2009-08-06 18:20       ` Paul Moore
2009-08-07  0:00         ` Herbert Xu
2009-08-07 12:23           ` Paul Moore
2009-08-06 10:10     ` Herbert Xu
2009-08-06 10:21       ` Eric W. Biederman
2009-08-06 13:37         ` Herbert Xu
2009-08-06 14:27           ` Eric W. Biederman
2009-08-06 14:39             ` Herbert Xu
2009-08-06 15:02               ` Eric W. Biederman
2009-08-06 18:09                 ` Paul Moore
2009-08-06 18:41                   ` David Miller
2009-08-07  0:22                 ` Herbert Xu
2009-08-07  3:40                   ` David Miller
2009-08-07  4:22                     ` Eric W. Biederman
2009-08-10  4:52                       ` 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=20090809.215246.48399343.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=paul.moore@hp.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).