Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3083895ybb; Mon, 30 Mar 2020 20:30:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvUZHNI4gK59myGkSC7gw9KS6GGFDWn9QPGvun3zAFrgu+Cn7aoms+xI2nhB/rsuktUWufU X-Received: by 2002:a4a:9c8d:: with SMTP id z13mr11918815ooj.50.1585625399924; Mon, 30 Mar 2020 20:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585625399; cv=none; d=google.com; s=arc-20160816; b=h5tm9ZJq4KKqZt0gy9gYUgtdzT1YjpTlMewWRcDv6uFW7QH6PitXePCk/ZyVDiXFja OigWIBLgtFKz/ZlP+AkLF0TS2H9/ZaqI0ZAAHkUYXtN9u9RjNtsWxqBh3MpseeharE2S OK6h/BEpzFL0mMNlBbhQ/DnHy93MNISV4eaY+Ueey1I7Lj34+JMnywS/4E1yVZjtrLeU HjbTVPZx/Nqb9vhKW/H7urszpj4Ctba87M/2tsjMPH2znB9yD1xKrQVE0yI9VdAc9p6a oMOvIHd4Rmh2LtwHtTKKb0V+em+VYt0LfgmGtzEMusccpazB/5YD99WgxnRJ7qPkYy2k pWEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=WhvIKiAZ62YDlD1oWveLP+fNPkAUs0qLIZB4yIs6/dg=; b=gPOP/Q46irHmFSu47aRS008WQaTfo3rYQ6xm5GZhgeZGfXKctyoD+hGjUwiDQhSMhH RfvrEk1lw9vR8jm7VW/zbX5MsJ10O77qa2mWdFMkjMJDwikSqLdaxggenOQuU7Kkkylh SMX9XCOkyvXRhG+6oAy0v0Z4ydRB9rvUZZ5mazohe+k5bFMT/jtmJP0RA40qm7VaB5rE VwTCemrZ5QeuK4vzTFPK8qS4nTNpsgYm+Bt6Q74lmOaXfjR4BUfYvntGgNlZYh0LlTMf cCaw1/XxthMD89tFjbINalIri+3zTSkthRmHgr3YuZKrcTPx7P5wvp/znifyE0zKJcLo Fpeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bNf3rzkg; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si6981115oib.135.2020.03.30.20.29.34; Mon, 30 Mar 2020 20:29:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bNf3rzkg; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729013AbgCaD2Z (ORCPT + 99 others); Mon, 30 Mar 2020 23:28:25 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34554 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbgCaD2Z (ORCPT ); Mon, 30 Mar 2020 23:28:25 -0400 Received: by mail-pl1-f193.google.com with SMTP id a23so7600626plm.1; Mon, 30 Mar 2020 20:28:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WhvIKiAZ62YDlD1oWveLP+fNPkAUs0qLIZB4yIs6/dg=; b=bNf3rzkgLVBSncpOONhhDp4K7PRzDa+Yzl/FsqGoGmv/dtEwZ+P6HsEA2KCXF2aYXa 7goBcZk1N5lG2V4WWL/qySJ4mMKAsVew3ufGxgJuAa5QYsaQjC/iVmk5GzSPBpINeSaK KiANoTI9nZgMqUTbjDYTVTDH+b9AbfMixl60l5p+MfJWnpPZQUQqTIF+6p79iBSPcnEf Xjt9GYxR7t5eVyK8nxLrsiK/SbilC3xQ2XN1yaG4mgyhulinoYUxS9x+7V1Ktwu4dP/p TNfbOD8FEXqZdXDqV34tjsug9RwixqmxgExoWEPWQYdtwANAXDC60t4Sxi71Ym9IE6ak 66LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WhvIKiAZ62YDlD1oWveLP+fNPkAUs0qLIZB4yIs6/dg=; b=P5LS8wg8gDkCNrPYzO9ASrwsXcXiCu5BrkcfS4IUVceqaoB/v4hDpc9LOzloW/XPgW 38FCXUso1UQWWwhw/MDkgseqqGMZpIFxKNARiu0sadcPOOZCi0IpUl4dBtZwEyT/6HZx hZm6Kc+6iDESKy5GlYnv4PRYvJd0yrUljGKihtDa0O7Wixm5p5+RB6h2K6CXoyqOREni IfQZKyAPZnbE3WNT9FzSMHPXJUdh/BE5iIv7nl0ZIx/vO70QAI2Sb6LwODSHku54I8eF iPhepnOrLgWrMhiCfZclfWcnevaQOAlIDieaVdwWT57uEiZWj2N8pvxypFvZWkszb3Mw A2EQ== X-Gm-Message-State: ANhLgQ2ZVBIptdxvMj2mYh+SRgIirA/PKO4VpNu/Rv/cCFZPQ+WPZVGz bAYoVYO/4B6CUOnW6E64lJga8O7M X-Received: by 2002:a17:902:aa97:: with SMTP id d23mr15465999plr.244.1585625302223; Mon, 30 Mar 2020 20:28:22 -0700 (PDT) Received: from VM_0_35_centos.localdomain ([150.109.62.251]) by smtp.gmail.com with ESMTPSA id v59sm761223pjb.26.2020.03.30.20.28.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2020 20:28:21 -0700 (PDT) From: Qiujun Huang To: ath9k-devel@qca.qualcomm.com, kvalo@codeaurora.org Cc: davem@davemloft.net, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, anenbupt@gmail.com, Qiujun Huang Subject: [PATCH] ath9k: fix stack-out-of-bounds Write in ath9k_hif_usb_rx_cb Date: Tue, 31 Mar 2020 11:28:16 +0800 Message-Id: <1585625296-31013-1-git-send-email-hqjagain@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add barrier to accessing the stack array skb_pool. Reported-by: syzbot+d403396d4df67ad0bd5f@syzkaller.appspotmail.com Signed-off-by: Qiujun Huang --- 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 dd0c323..c4a2b72 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, -- 1.8.3.1