public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] wext: fix get_wireless_stats locking
Date: Mon, 11 May 2009 15:56:50 +0200	[thread overview]
Message-ID: <1242050210.29777.7.camel@johannes.local> (raw)
In-Reply-To: <20090511125442.GB2721@tuxdriver.com>

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

On Mon, 2009-05-11 at 08:54 -0400, John W. Linville wrote:
> On Sun, May 10, 2009 at 01:00:17PM +0200, Johannes Berg wrote:
> > Currently, get_wireless_stats is racy by _design_. This is
> > because it returns a buffer, which needs to be statically
> > allocated since it cannot be freed if it was allocated
> > dynamically. Also, SIOCGIWSTATS and /proc/net/wireless use
> > no common lock, and /proc/net/wireless accesses are not
> > synchronised against each other. This is a design flaw in
> > get_wireless_stats since the beginning.
> > 
> > This patch fixes it by wrapping /proc/net/wireless accesses
> > with the RTNL so they are protected against each other and
> > SIOCGIWSTATS. The more correct method of fixing this would
> > be to pass in the buffer instead of returning it and have
> > the caller take care of synchronisation of the buffer, but
> > even then most drivers probably assume that their callback
> > is protected by the RTNL like all other wext callbacks.
> > 
> > Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> 
> Is it acceptable to hold rtnl between ->open and ->release?

Hmm. It worked for me, but now I'm having doubts. This stuff confuses
me. I'll check it out.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2009-05-11 13:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-10 11:00 [PATCH] wext: fix get_wireless_stats locking Johannes Berg
2009-05-11 12:54 ` John W. Linville
2009-05-11 13:56   ` Johannes Berg [this message]
2009-05-11 14:06   ` [PATCH v2] " Johannes Berg

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=1242050210.29777.7.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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