mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Deepakkumar Karn <dkarn@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	 shaul.triebitz@intel.com,
	 syzbot+5bb5f06f99924ea0cf86@syzkaller.appspotmail.com
Subject: Re: [PATCH] mac80211_hwsim: fix divide error in mac80211_hwsim_link_info_changed
Date: Mon, 08 Dec 2025 09:29:54 +0100	[thread overview]
Message-ID: <3012de51f1dd363d1ba8f34bd1252add2977f608.camel@sipsolutions.net> (raw)
In-Reply-To: <20251206173345.356068-1-dkarn@redhat.com>

On Sat, 2025-12-06 at 23:03 +0530, Deepakkumar Karn wrote:
> 
> 
> Thank you for your response Johannes. cfg80211 already have validation 
> in cfg80211_validate_beacon_int().

Oh OK.

> The problem seems to occur in 
> case of interface shutdown which calls ieee80211_do_stop() that makes 
> beacon_int = 0 or set_tsf which causes divides by zero.

Why would that call set_tsf()?

And yeah that should make beacon_int=0, but not have beaconing enabled.

> What if we:
> 1. Handle off-channel operation:

>                 if (test_and_clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
>                                        &sdata->state)) {
> -                       sdata->vif.bss_conf.enable_beacon = true;
> -                       ieee80211_link_info_change_notify(
> -                               sdata, &sdata->deflink,
> -                               BSS_CHANGED_BEACON_ENABLED);
> +                       if (sdata->vif.bss_conf.beacon_int) {
> +                               sdata->vif.bss_conf.enable_beacon = true;
> +                               ieee80211_link_info_change_notify(
> +                                       sdata, &sdata->deflink,
> +                                       BSS_CHANGED_BEACON_ENABLED);
> +                       }

don't follow, that only does it when beacon was actually stopped ...
maybe do_stop() needs to clear that bit if there's a possibility of this
happening in the wrong order, but I don't see how there could be a race
since off-channel must also be stopped at that point anyway, unless that
is in the wrong order.

> 2. Handle case where debugfs is written after shutdown or any race condition during disable beaconing:
> 
> diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
> index 551f5eb4e747..8363cdd17a97 100644
> --- a/drivers/net/wireless/virtual/mac80211_hwsim.c

first of all, I really do think you should *not* (need to) modify hwsim
at all

>         conf = link_conf_dereference_protected(vif, data->link_data[0].link_id);
> -       if (conf && !conf->enable_beacon)
> +       if ((conf && !conf->enable_beacon) || !bcn_int)
>                 return;

But this also makes no sense, it shouldn't be possible to have beacon
enabled and beacon interval == 0.

johannes

  reply	other threads:[~2025-12-08  8:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 15:35 Deepakkumar Karn
2025-12-05 17:39 ` Johannes Berg
2025-12-05 23:03   ` Deepakkumar Karn
2025-12-06 14:56     ` Johannes Berg
2025-12-06 17:33       ` Deepakkumar Karn
2025-12-08  8:29         ` Johannes Berg [this message]
2025-12-10 18:56           ` Deepak Karn

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=3012de51f1dd363d1ba8f34bd1252add2977f608.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=dkarn@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=shaul.triebitz@intel.com \
    --cc=syzbot+5bb5f06f99924ea0cf86@syzkaller.appspotmail.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®