All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+90d241d7661ca2493f0b@syzkaller.appspotmail.com>
Cc: ath9k-devel@qca.qualcomm.com, davem@davemloft.net,
	kuba@kernel.org, kvalo@codeaurora.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] divide error in ath9k_htc_swba
Date: Fri, 18 Jun 2021 13:31:12 +0300	[thread overview]
Message-ID: <20210618133112.596c60d8@gmail.com> (raw)
In-Reply-To: <0000000000002a48dd05c506e7cc@google.com>

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

On Fri, 18 Jun 2021 02:25:22 -0700
syzbot <syzbot+90d241d7661ca2493f0b@syzkaller.appspotmail.com> wrote:

> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    37fdb7c9 Merge tag 'v5.13-rc6' into usb-next
> git tree:
> https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> usb-testing console output:
> https://syzkaller.appspot.com/x/log.txt?x=1702bbebd00000 kernel
> config:  https://syzkaller.appspot.com/x/.config?x=e3b6ba4f6e6c6ddf
> dashboard link:
> https://syzkaller.appspot.com/bug?extid=90d241d7661ca2493f0b syz
> repro:
> https://syzkaller.appspot.com/x/repro.syz?x=113b98b8300000 C
> reproducer:   https://syzkaller.appspot.com/x/repro.c?x=134650f7d00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the
> commit: Reported-by:
> syzbot+90d241d7661ca2493f0b@syzkaller.appspotmail.com

 
#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master





With regards,
Pavel Skripkin

[-- Attachment #2: 0001-net-wireless-ath9k-fix-divide-error.patch --]
[-- Type: text/x-patch, Size: 1976 bytes --]

From d9a4de91e4752866c78019fbeadaa471543550a5 Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <paskripkin@gmail.com>
Date: Fri, 18 Jun 2021 13:29:27 +0300
Subject: [PATCH] net: wireless: ath9k: fix divide error

/* ---- */

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/net/wireless/ath/ath9k/htc.h          | 1 +
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 2 ++
 drivers/net/wireless/ath/ath9k/wmi.c          | 6 ++++++
 3 files changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index 0a1634238e67..1aaacdcda7ea 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -532,6 +532,7 @@ struct ath9k_htc_priv {
 #endif
 	struct mutex mutex;
 	struct ieee80211_vif *csa_vif;
+	atomic_t initialized;
 };
 
 static inline void ath_read_cachesize(struct ath_common *common, int *csz)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index ff61ae34ecdf..c3288bb07137 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -965,6 +965,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev,
 	if (ret)
 		goto err_init;
 
+	atomic_set(&priv->initialized, 1);
+
 	return 0;
 
 err_init:
diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c
index fe29ad4b9023..a5f31ee86f04 100644
--- a/drivers/net/wireless/ath/ath9k/wmi.c
+++ b/drivers/net/wireless/ath/ath9k/wmi.c
@@ -146,6 +146,12 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t)
 	unsigned long flags;
 	u16 cmd_id;
 
+	if (!atomic_read(&priv->initialized))
+		/* If tasked has been called with uninitalized ath9k_htc_priv,
+		 * it can cause divide-by-zero error in ath9k_htc_swba
+		 */
+		return;
+
 	do {
 		spin_lock_irqsave(&wmi->wmi_lock, flags);
 		skb = __skb_dequeue(&wmi->wmi_event_queue);
-- 
2.32.0


  reply	other threads:[~2021-06-18 10:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  9:25 [syzbot] divide error in ath9k_htc_swba syzbot
2021-06-18 10:31 ` Pavel Skripkin [this message]
2021-06-18 10:49   ` syzbot
2024-06-09  8:10 ` [syzbot] [usb?] [wireless?] " syzbot

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=20210618133112.596c60d8@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+90d241d7661ca2493f0b@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.