Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2093376ybl; Thu, 30 Jan 2020 11:14:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxc+rJpIf4K7q7/1ZfIVkxLRi8vPKUnm07Xw6rBg0pw+5+WwskVYX56riDh8CIrSbzyhpRO X-Received: by 2002:a9d:7c99:: with SMTP id q25mr4823755otn.105.1580411658946; Thu, 30 Jan 2020 11:14:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411658; cv=none; d=google.com; s=arc-20160816; b=0bjs59TcvDe0DANI5F85XNr7ed0D5HQM0BkCZmSUT+hl0Gvcj1ElVTLdNqj8vfhzfQ DP3ZORFUJQEod+HREAcBXNDGsWLiNBHy7V8OFaABbRiknpjrhnbX9It4CvQL3Vj7Tbnv nPBXb9zyNiR5WLuwoIy2P1HoLH22rQ/C0jFV+8buGTD6VSLZoSmM9qZOmHZUX/cU+wxi TP8IaabHehVaqEQVSt1KmxOrwFXWPYWWgVW0U+wyhUskL+GnsTQSruaYip1jWdxpppno Z7+ZXds7dfM4YJHvZqgxM2AHCR+E6FHeCO2baiACU6sCRIgppksS6MMq7Dt5wDIfeozs NtEw== 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=on4IOL4p9x+uWL8mlNYcYMsvNJdZLh8zpdC3ZS30MxAVPpVHU3npiHm4ySsu3Dkqol Q1kBn7+pJOiwazsj5VQfcxjEE0Ff5ZgsMTXX8azcFNRM+9k88F0GtGSKgEOQnGWI2viy NAGDrG+QZYftRwTZuuwS9OxzjgSZbG3YP662ZqCJKw08Yt0gp/7qLj+nKAJJLZVtHCUo 8qIphMeSsQuiUxJgwLf+0TaJp5hCH2loPXZMxoNBNwZGMHYtotGLLG2LvAQcPiQbcbRs XHT7Zm79Dwy47jvBJrcqvByFwtgfZQx+In/pWAzPVr9jBLPZGQPiZ4ZSFwGFCfaQfWo4 pmvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DstCog62; 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 t18si3497066otc.230.2020.01.30.11.14.05; Thu, 30 Jan 2020 11:14:18 -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=DstCog62; 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 S1730164AbgA3Sl0 (ORCPT + 99 others); Thu, 30 Jan 2020 13:41:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:49310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730152AbgA3SlY (ORCPT ); Thu, 30 Jan 2020 13:41:24 -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 81C182082E; Thu, 30 Jan 2020 18:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409683; bh=7jlyodMR1hMib1vLo8tBYpdkJz1ljJqLkFdpx1YkWZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DstCog62vcLfkeVuKwafd+qjwdcvySiauIBmDWIez6ssJ89vQHeDRLh1PpiYS450f 689xlbjPw0i8e3stguR4jKRnN9EHwhqbf93uGAn5vRdN4ICB3nOQCOppQDle0IApga IhtxVGS62zO4ycRR8emlrG8+lq95UxDlit7HbfA0= 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.5 49/56] rsi: fix non-atomic allocation in completion handler Date: Thu, 30 Jan 2020 19:39:06 +0100 Message-Id: <20200130183617.803270823@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183608.849023566@linuxfoundation.org> References: <20200130183608.849023566@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; }