Received: by 10.213.65.68 with SMTP id h4csp470248imn; Fri, 16 Mar 2018 08:44:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELsy8FCoIkbN40n3iTo5nzBqiWx7D45SYIWAaPdDZ7qqhvbhX4K2HbsUy6+F8RzSTrDO45AW X-Received: by 10.98.233.3 with SMTP id j3mr1989264pfh.38.1521215052365; Fri, 16 Mar 2018 08:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215052; cv=none; d=google.com; s=arc-20160816; b=PCGGi4fjYiFeY3QHCfmo9o7GP/hc1UXOSqCx2Ade2MvH7GkEiopJctumrUmP6K1jsd dyo26Dk2VQLLlu9h0lnCvstVZZWUApFJyfXQgr2fdVJCvsc77K7cOVOdDK2OxbGaACPP WOgb1iYuZoGT243Hjxp5hVUtWCksfmYnIbzq4D42YCvKUn0k+qVAi8QfQIkzIZWWqfwO Qo3BXb6muMtcRoIJ+jOmp32kdHGYDcfOWpys5EkA8i780VqAnAcJrWI7CUTiMfLgO+j0 KJDlweMJzlwaiti1iSK9473V7EkErDlgx1L/Hvy/iyo2TxcJYHerR6uE/bHPOih1R4bt 73xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=76Igaicf6nnLdUEVUkpAcTdM0lzrL3nPWjkmgdB/GS4=; b=pVgsHRAYraLQkDGo/jHTjeB+ifOTIKJf8JwQSGysHqSANuI0DFCckfa/XAcEuse2z3 sRt25ugwgHHFmC3rAbhUxtH9Ngo0oLhGkbF8ZAlqwiaYnBis0BW1hKXZNzHJNV2RpgDH FKerP74vpvEEySVSBlsPESpdxmOuxuBAWsCimb6XQ1IXiHJNFlJbmA0GlWrhyv2aRepW WiyDMnTV+0qoHbRkD9dh3w6bjD7iWQHfHNGsosD8nTD+BYETGCQGrnPUEYqDhexLx+tJ hdsxUq1tKGUsDblT9WV3ScYgPOzyRPPmx/hg2JsODWcwyKgpAc9RXc7LfEP5qJkxfJtP cXow== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u19si5705814pfk.128.2018.03.16.08.43.58; Fri, 16 Mar 2018 08:44:12 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964959AbeCPPms (ORCPT + 99 others); Fri, 16 Mar 2018 11:42:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44532 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934419AbeCPPmk (ORCPT ); Fri, 16 Mar 2018 11:42:40 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 5DBA6FDB; Fri, 16 Mar 2018 15:42:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Larry Finger , Sasha Levin Subject: [PATCH 4.15 042/128] staging: rtl8822be: fix missing null check on dev_alloc_skb return Date: Fri, 16 Mar 2018 16:23:03 +0100 Message-Id: <20180316152338.865136709@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Colin Ian King [ Upstream commit 3eb23426e1749a0483bc4c9b18e51f657569e3ed ] dev_alloc_skb can potentially return NULL, so add a null check to avoid a null pointer dereference on skb Detected by CoverityScan, CID#1454558 ("Dereference on null return") Fixes: 7e5b796cde7e ("staging: r8822be: Add the driver code") Signed-off-by: Colin Ian King Acked-by: Larry Finger Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtlwifi/rtl8822be/fw.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/staging/rtlwifi/rtl8822be/fw.c +++ b/drivers/staging/rtlwifi/rtl8822be/fw.c @@ -464,6 +464,8 @@ bool rtl8822b_halmac_cb_write_data_rsvd_ int count; skb = dev_alloc_skb(size); + if (!skb) + return false; memcpy((u8 *)skb_put(skb, size), buf, size); if (!_rtl8822be_send_bcn_or_cmd_packet(rtlpriv->hw, skb, BEACON_QUEUE))