Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Zhao Li <enderaoelyther@gmail.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: cfg80211: publish PMSR request before starting the driver
Date: Thu, 23 Jul 2026 10:18:33 +0200	[thread overview]
Message-ID: <3552acdf7839106b152edfd13502684306ea42a3.camel@sipsolutions.net> (raw)
In-Reply-To: <20260723010916.76433-1-enderaoelyther@gmail.com> (sfid-20260723_030932_237420_AA10BE01)

On Thu, 2026-07-23 at 09:09 +0800, Zhao Li wrote:
> 
> This ordering also permits a successful driver callback to complete the
> request synchronously. Document the resulting start_pmsr lifetime contract.

From a locking perspective perhaps yes, but cfg80211_pmsr_complete()
sends the results to userspace immediately, so userspace might see a
completion with a cookie before it even got the cookie as the request
response, which (semantically) makes no sense.

Given that measurement requests are always going to take some time, I
don't think this is an issue in practice that we really need to work
hard to prevent (we'd have to do something like attaching the result to
the request on the list, pivot to a wiphy locked worker, etc.)

However, I don't think it makes sense to actually *document* that it's
now possible - it's only possible from the kernel's locking POV, from
userspace's POV it's still highly confusing at best, and it makes no
sense semantically either.

At best the documentation would be something like "the kernel doesn't
crash if the request is completed before returning success" but that's
not useful either :)

> +	/*
> +	 * Publish before the driver can complete the request. Completion may free
> +	 * it before rdev_start_pmsr() returns, so use the cookie snapshot below.
> +	 */

That comment then should call out how it's really about preventing races
with drivers from doing UAF (we could technically be preempted here
too), rather than making that sound like a reasonable order - just
saying "Under races and/or broken drivers immediate completion might
free it ..." or something along those lines would be better I think.

johannes

  reply	other threads:[~2026-07-23  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  1:09 [PATCH] wifi: cfg80211: publish PMSR request before starting the driver Zhao Li
2026-07-23  8:18 ` Johannes Berg [this message]
2026-07-23 20:22   ` Zhao Li
2026-07-23 20:22 ` [PATCH v2] " Zhao Li

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=3552acdf7839106b152edfd13502684306ea42a3.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=enderaoelyther@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@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