public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Ziyi Guo <n7l8m4@u.northwestern.edu>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: iwlegacy: add missing mutex protection in il3945_store_measurement()
Date: Mon, 26 Jan 2026 19:58:25 +0100	[thread overview]
Message-ID: <20260126185825.GA6968@wp.pl> (raw)
In-Reply-To: <20260125193005.1090429-1-n7l8m4@u.northwestern.edu>

On Sun, Jan 25, 2026 at 07:30:05PM +0000, Ziyi Guo wrote:
> il3945_store_measurement() calls il3945_get_measurement() which internally
> calls il_send_cmd_sync() without holding il->mutex. However,
> il_send_cmd_sync() has lockdep_assert_held(&il->mutex) indicating that
> callers must hold this lock.
> 
> Other sysfs store functions in the same file properly acquire the mutex:
> - il3945_store_flags() acquires mutex at 3945-mac.c:3110
> - il3945_store_filter_flags() acquires mutex at 3945-mac.c:3144
> 
> Add mutex_lock()/mutex_unlock() around the il3945_get_measurement() call
> in the sysfs store function to fix the missing lock protection.
> 
> Signed-off-by: Ziyi Guo <n7l8m4@u.northwestern.edu>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

> ---
>  drivers/net/wireless/intel/iwlegacy/3945-mac.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> index 104748fcdc33..54991f31c52c 100644
> --- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> @@ -3224,7 +3224,9 @@ il3945_store_measurement(struct device *d, struct device_attribute *attr,
>  
>  	D_INFO("Invoking measurement of type %d on " "channel %d (for '%s')\n",
>  	       type, params.channel, buf);
> +	mutex_lock(&il->mutex);
>  	il3945_get_measurement(il, &params, type);
> +	mutex_unlock(&il->mutex);
>  
>  	return count;
>  }
> -- 
> 2.34.1
> 

      reply	other threads:[~2026-01-26 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 19:30 [PATCH] wifi: iwlegacy: add missing mutex protection in il3945_store_measurement() Ziyi Guo
2026-01-26 18:58 ` Stanislaw Gruszka [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=20260126185825.GA6968@wp.pl \
    --to=stf_xl@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=n7l8m4@u.northwestern.edu \
    /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