netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Qiujun Huang <hqjagain@gmail.com>,
	syzbot+d403396d4df67ad0bd5f@syzkaller.appspotmail.com,
	Kalle Valo <kvalo@codeaurora.org>,
	Sasha Levin <sashal@kernel.org>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.4 003/175] ath9x: Fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb
Date: Mon,  8 Jun 2020 19:15:56 -0400	[thread overview]
Message-ID: <20200608231848.3366970-3-sashal@kernel.org> (raw)
In-Reply-To: <20200608231848.3366970-1-sashal@kernel.org>

From: Qiujun Huang <hqjagain@gmail.com>

[ Upstream commit 19d6c375d671ce9949a864fb9a03e19f5487b4d3 ]

Add barrier to accessing the stack array skb_pool.

The case reported by syzbot:
https://lore.kernel.org/linux-usb/0000000000003d7c1505a2168418@google.com
BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_stream
drivers/net/wireless/ath/ath9k/hif_usb.c:626 [inline]
BUG: KASAN: stack-out-of-bounds in ath9k_hif_usb_rx_cb+0xdf6/0xf70
drivers/net/wireless/ath/ath9k/hif_usb.c:666
Write of size 8 at addr ffff8881db309a28 by task swapper/1/0

Call Trace:
ath9k_hif_usb_rx_stream drivers/net/wireless/ath/ath9k/hif_usb.c:626
[inline]
ath9k_hif_usb_rx_cb+0xdf6/0xf70
drivers/net/wireless/ath/ath9k/hif_usb.c:666
__usb_hcd_giveback_urb+0x1f2/0x470 drivers/usb/core/hcd.c:1648
usb_hcd_giveback_urb+0x368/0x420 drivers/usb/core/hcd.c:1713
dummy_timer+0x1258/0x32ae drivers/usb/gadget/udc/dummy_hcd.c:1966
call_timer_fn+0x195/0x6f0 kernel/time/timer.c:1404
expire_timers kernel/time/timer.c:1449 [inline]
__run_timers kernel/time/timer.c:1773 [inline]
__run_timers kernel/time/timer.c:1740 [inline]
run_timer_softirq+0x5f9/0x1500 kernel/time/timer.c:1786

Reported-and-tested-by: syzbot+d403396d4df67ad0bd5f@syzkaller.appspotmail.com
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200404041838.10426-5-hqjagain@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/wireless/ath/ath9k/hif_usb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index dd0c32379375..c4a2b7201ce3 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -612,6 +612,11 @@ static void ath9k_hif_usb_rx_stream(struct hif_device_usb *hif_dev,
 			hif_dev->remain_skb = nskb;
 			spin_unlock(&hif_dev->rx_lock);
 		} else {
+			if (pool_index == MAX_PKT_NUM_IN_TRANSFER) {
+				dev_err(&hif_dev->udev->dev,
+					"ath9k_htc: over RX MAX_PKT_NUM\n");
+				goto err;
+			}
 			nskb = __dev_alloc_skb(pkt_len + 32, GFP_ATOMIC);
 			if (!nskb) {
 				dev_err(&hif_dev->udev->dev,
-- 
2.25.1


  parent reply	other threads:[~2020-06-09  0:17 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200608231848.3366970-1-sashal@kernel.org>
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 002/175] ath10k: Fix the race condition in firmware dump work queue Sasha Levin
2020-06-08 23:15 ` Sasha Levin [this message]
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 004/175] ath9k: Fix use-after-free Write in ath9k_htc_rx_msg Sasha Levin
2020-06-08 23:15 ` [PATCH AUTOSEL 5.4 005/175] ath9k: Fix use-after-free Read in htc_connect_service Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 016/175] libbpf: Fix memory leak and possible double-free in hashmap__clear Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 020/175] net: atlantic: make hw_get_regs optional Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 021/175] net: ena: fix error returning in ena_com_get_hash_function() Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 023/175] ath10k: remove the max_sched_scan_reqs value Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 026/175] rtw88: fix an issue about leak system resources Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 035/175] ixgbe: Fix XDP redirect on archs with PAGE_SIZE above 4K Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 038/175] Bluetooth: Add SCO fallback for invalid LMP parameters error Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 051/175] batman-adv: Revert "disable ethtool link speed detection when auto negotiation off" Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 052/175] ice: Fix memory leak Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 053/175] ice: Fix for memory leaks and modify ICE_FREE_CQ_BUFS Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 058/175] net: vmxnet3: fix possible buffer overflow caused by bad DMA value in vmxnet3_get_rss() Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 059/175] tun: correct header offsets in napi frags mode Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 062/175] ath10k: fix kernel null pointer dereference Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 063/175] ath9k: Fix use-after-free Read in ath9k_wmi_ctrl_rx Sasha Levin
2020-06-08 23:16 ` [PATCH AUTOSEL 5.4 064/175] ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 067/175] brcmfmac: fix wrong location to get firmware feature Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 070/175] e1000: Distribute switch variables for initialization Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 077/175] ath10k: add flush tx packets for SDIO chip Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 081/175] dpaa2-eth: fix return codes used in ndo_setup_tc Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 082/175] netfilter: nft_nat: return EOPNOTSUPP if type or flags are not supported Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 083/175] selftests/bpf: Fix memory leak in extract_build_id() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 084/175] net: bcmgenet: set Rx mode before starting netif Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 085/175] net: bcmgenet: Fix WoL with password after deep sleep Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 092/175] net: lpc-enet: fix error return code in lpc_mii_init() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 094/175] drivers: net: davinci_mdio: fix potential NULL dereference in davinci_mdio_probe() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 096/175] net: allwinner: Fix use correct return type for ndo_start_xmit() Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 098/175] ath9k_htc: Silence undersized packet warnings Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 099/175] libertas_tf: avoid a null dereference in pointer priv Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 112/175] iwlwifi: avoid debug max amsdu config overwriting itself Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 116/175] ath10k: Remove msdu from idr when management pkt send fails Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 117/175] wcn36xx: Fix error handling path in 'wcn36xx_probe()' Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 118/175] net: qed*: Reduce RX and TX default ring count when running inside kdump kernel Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 120/175] mt76: avoid rx reorder buffer overflow Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 123/175] net: dsa: mt7530: set CPU port to fallback mode Sasha Levin
2020-06-08 23:17 ` [PATCH AUTOSEL 5.4 126/175] veth: Adjust hard_start offset on redirect XDP frames Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 127/175] net/mlx5e: IPoIB, Drop multicast packets that this interface sent Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 128/175] rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup() Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 129/175] mwifiex: Fix memory corruption in dump_station Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 140/175] selftests/bpf: CONFIG_IPV6_SEG6_BPF required for test_seg6_loop.o Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 146/175] net: ethernet: fec: move GPR register offset and bit into DT Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 147/175] macvlan: Skip loopback packets in RX handler Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 157/175] ice: fix potential double free in probe unrolling Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 158/175] ixgbe: fix signed-integer-overflow warning Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 159/175] iwlwifi: mvm: fix aux station leak Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 167/175] vxlan: Avoid infinite loop when suppressing NS messages with invalid options Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 168/175] libbpf: Fix perf_buffer__free() API for sparse allocs Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 169/175] bpf: Fix map permissions check Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 170/175] bpf: Refactor sockmap redirect code so its easy to reuse Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 171/175] bpf: Fix running sk_skb program types with ktls Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 172/175] selftests/bpf, flow_dissector: Close TAP device FD after the test Sasha Levin
2020-06-08 23:18 ` [PATCH AUTOSEL 5.4 173/175] net_failover: fixed rollback in net_failover_open() Sasha Levin

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=20200608231848.3366970-3-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=hqjagain@gmail.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+d403396d4df67ad0bd5f@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;
as well as URLs for NNTP newsgroup(s).