Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2099405ybl; Thu, 30 Jan 2020 11:20:32 -0800 (PST) X-Google-Smtp-Source: APXvYqznYuQdrUV1hbLamYKoA6AGg5S4QsmjtIEGOUQsv0cziww/TnYEnJpbiIgaYcOlEQhkGZpH X-Received: by 2002:a54:4716:: with SMTP id k22mr3955236oik.39.1580412032208; Thu, 30 Jan 2020 11:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580412032; cv=none; d=google.com; s=arc-20160816; b=xjkRNUR0e4swAcflyAJVi67dHZZOHgQxPNmnokeAtbRRM/IUYTm48ThLo5+fl2D+xT qrXOsGtYtR6IKWO1RI9Noa+OXbjowf7I0zTTTNDn4uZ7fpreszNrrRhHkglXsoFTEgcG SANVYtK8NvksdlowXHacde+Yio6jNw13sl1lZFONwvJFtuALqMVRTLb11pBvTZQV7e8l id9bRgb6QFdFsag1GW0SF2kmdJJ0SjeBho0fUQmxpmd2HrUrvmPdnXAVNK8RRU4WhQJv Iry7H96l/uQlPfcCnnvm/967P6udXynNjdePNHNFbgtK715sn0u9HYCljUUH7fuFa/m3 W29g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VA9MsIxbaKPlG6GANXTl3ANrMPHGIUdCUqNz9qYH6v8=; b=yYMekFnc96JsZ8kHuQotStBQSm1rEl8PnJ3kXRstStH1bZZzsU461LqghIhb4ctVBv msDPOtunmGRzkktBmoQI00+ff/GEOdyNh858vF9azi+5rwgE6DOCFEQG+yK2fqhgJ3FQ fb0lw/Zd0f+MIkNLi641pQ+PgUzbJHAvXCuRnGQwUO9+xzeIoERGSWooIkaYiNU0M6zT CSTkYVBp5wV1yjvetBng+gxjFhgBWhYgx3eOmdG93K9HA75P/XvP7bIV+MrR3yzrzGL6 aUsxz63Wxsm0oRrauzNVFVgJhgHWBvmjYjaa9Qykjuu3sDKPHoLSEbvyFw7C55eQCi4J qgyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UrHGxclw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g24si3542796otj.59.2020.01.30.11.20.20; Thu, 30 Jan 2020 11:20:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b=UrHGxclw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728090AbgA3SqP (ORCPT + 99 others); Thu, 30 Jan 2020 13:46:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:55922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731123AbgA3SqE (ORCPT ); Thu, 30 Jan 2020 13:46:04 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 230FB20674; Thu, 30 Jan 2020 18:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409963; bh=7jlyodMR1hMib1vLo8tBYpdkJz1ljJqLkFdpx1YkWZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrHGxclw1KMYn3SsVyDUTF3hJs+JcbIJ5kIKPlSOI4WXcgC9c6CY0NIdVIKAviNyx 3TMH1XLaFt229TdBdXMF9vOocMqobqeqVIGndufZZZxE1FRax4lOB7H7kxFrstk93x fpixHP2pgvadmuj8JT4n5qUYhmrJDzRed81wkRPA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prameela Rani Garnepudi , Johan Hovold , Kalle Valo Subject: [PATCH 5.4 103/110] rsi: fix non-atomic allocation in completion handler Date: Thu, 30 Jan 2020 19:39:19 +0100 Message-Id: <20200130183625.791081129@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Johan Hovold commit b9b9f9fea21830f85cf0148cd8dce001ae55ead1 upstream. USB completion handlers are called in atomic context and must specifically not allocate memory using GFP_KERNEL. Fixes: a1854fae1414 ("rsi: improve RX packet handling in USB interface") Cc: stable # 4.17 Cc: Prameela Rani Garnepudi Signed-off-by: Johan Hovold Signed-off-by: Kalle Valo Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/rsi/rsi_91x_usb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/rsi/rsi_91x_usb.c +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c @@ -16,6 +16,7 @@ */ #include +#include #include #include "rsi_usb.h" #include "rsi_hal.h" @@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode, "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n" "6[AP + BT classic], 14[AP + BT classic + BT LE]"); -static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num); +static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags); /** * rsi_usb_card_write() - This function writes to the USB Card. @@ -285,7 +286,7 @@ static void rsi_rx_done_handler(struct u status = 0; out: - if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num)) + if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC)) rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__); if (status) @@ -307,7 +308,7 @@ static void rsi_rx_urb_kill(struct rsi_h * * Return: 0 on success, a negative error code on failure. */ -static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num) +static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags) { struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev; struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1]; @@ -337,7 +338,7 @@ static int rsi_rx_urb_submit(struct rsi_ rsi_rx_done_handler, rx_cb); - status = usb_submit_urb(urb, GFP_KERNEL); + status = usb_submit_urb(urb, mem_flags); if (status) { rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__); dev_kfree_skb(skb); @@ -827,12 +828,12 @@ static int rsi_probe(struct usb_interfac rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__); } - status = rsi_rx_urb_submit(adapter, WLAN_EP); + status = rsi_rx_urb_submit(adapter, WLAN_EP, GFP_KERNEL); if (status) goto err1; if (adapter->priv->coex_mode > 1) { - status = rsi_rx_urb_submit(adapter, BT_EP); + status = rsi_rx_urb_submit(adapter, BT_EP, GFP_KERNEL); if (status) goto err_kill_wlan_urb; }