Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp621515yba; Sat, 13 Apr 2019 09:16:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOvXSN8YDAO4npM/lG2rJ0vtpe84J5MRrKchKbmZC8+AGXDMgO9IQEXR4mqdh0jjT5UGlU X-Received: by 2002:a65:4341:: with SMTP id k1mr60953551pgq.88.1555172200902; Sat, 13 Apr 2019 09:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555172200; cv=none; d=google.com; s=arc-20160816; b=BbzhivrgulB+Uqi+MpjBaxePsv1isSAWx2AkuXuMbOI3KHj5MZgCbIys2P0ZPGE1j9 ZBsNnEoCjquTdnM+fDuiQbFjnchaEPs/4Yg7rMDOX4gjrxOD6lhy1y8O/mGtSFAJFLnC JTe3HkJGTHS9tm9NdeFCW6RtaTQqhJsWrIv43uJ0vagvD2n0j6HMJen4ee+ETpX3s85T LWq6yTThk8czAI9b+/FU7mfjCs7e0EdU3f/7s/Ts9QENpvBfhj/S50bxr+yay55IA/jd KL+A+x72dsFtIyM+RPc7CLSdNTl+FnXr2riZ+kzszj7iD1Pgkd+3b8AoFARPG3Kr3cYZ THsg== 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 :message-id:date:subject:cc:to:from; bh=WWm4UJxDZE3h/4SMIWEHUb1aIBITy6xf5xQzf29OrAA=; b=MqmkaD680yW0ywBncIgiyy3JnCcJ6H7zCSPhw6xNOL6rIQCTnEaxyHbhAZewWBGRWu I8H7fxm+/paiuKuLnKTEo/ESIKF1Q8vvO1Q/HpgNWbEc3QVDes3r/Xlsr6DBVCYUw/Ei fx8w8E5ULOFv3V11pZLXdFKVwnIO0d4sVx7NQe2Fkdw+Z3K+ELVAUiiRNZ1ebhbj6Yr+ FyCN59piWXKVYvl2K1kvf+jW3mwAPgXD799WJVUlJ1wAxoHMSX57lwc8XN0JaND9W4Rg Y+zvqIiT92TQPNuHFcVhmLS6LjU82q0DlD5jJVOXA64TUNeikOCEPDnsB9jQo2CeIiCh S3VA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si37366756plr.17.2019.04.13.09.16.11; Sat, 13 Apr 2019 09:16:40 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbfDMQPO (ORCPT + 99 others); Sat, 13 Apr 2019 12:15:14 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:47745 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbfDMQPO (ORCPT ); Sat, 13 Apr 2019 12:15:14 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hFLId-0006XN-6v; Sat, 13 Apr 2019 16:14:39 +0000 From: Colin King To: Amitkumar Karwar , Nishant Sarmukadam , Ganapathi Bhat , Xinming Hu , Kalle Valo , "David S . Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mwifiex: check for null return from skb_copy Date: Sat, 13 Apr 2019 17:14:38 +0100 Message-Id: <20190413161438.6376-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 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: Colin Ian King It is possible for skb_copy to return a null pointer and currently this will cause a null pointer dereference when the function mwifiex_uap_queue_bridged_pkt is called. Fix this by checking for a null return from skb_copy and return -ENOMEM. Addresses-Coverity: ("Dereference null return") Fixes: 838e4f449297 ("mwifiex: improve uAP RX handling") Signed-off-by: Colin Ian King --- drivers/net/wireless/marvell/mwifiex/uap_txrx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c index 5ce85d5727e4..b262dc78d638 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_txrx.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_txrx.c @@ -256,6 +256,8 @@ int mwifiex_handle_uap_rx_forward(struct mwifiex_private *priv, if (is_multicast_ether_addr(ra)) { skb_uap = skb_copy(skb, GFP_ATOMIC); + if (!skb_uap) + return -ENOMEM; mwifiex_uap_queue_bridged_pkt(priv, skb_uap); } else { if (mwifiex_get_sta_entry(priv, ra)) { -- 2.20.1