Received: by 10.213.65.68 with SMTP id h4csp505849imn; Fri, 16 Mar 2018 09:48:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELsHK3G7OEsrlpUWXQ0OIapdf3eVaNcTS7iDSo/I7dFX2s06aG7gQVpPqd2pmZp0K1fHXo6N X-Received: by 2002:a17:902:367:: with SMTP id 94-v6mr2922676pld.140.1521218935005; Fri, 16 Mar 2018 09:48:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218934; cv=none; d=google.com; s=arc-20160816; b=JaKEepNQOo0+Mn3QGYjOwE/NGTRKmv5iad44staFb2VLlB38/rRgeYNTmrnHh1UKUs 4w4w6i6pXPF3TFtB2Q/vvhL1sWYs/bwFbnamsvZYFMBziS6nG7uUCViby45fIGkOi5nK Gn4vFGHlIM5t+ArmBP36XPpcO3HWB61wiDL+1mhHyZdtAwDLI+FAdmFRWsmd+KAqrjDL eFjaLOE6veBcbDhPA9ADFRDH8Gq7ONMtNyc4oK7+/9RwUMXV/sJgLw4K3DbeWK1c5o6L pi9Ikr9dg8PzgeEsZ3H07QkHKKkTl1Sa4NotBtk7o/y8L3Fxl0mKeQHUX3tNlFXdew1+ DsaA== 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=ImngWB5javFA7da371JltbXxjUyFLUB81ictUSYYnpk=; b=eNPHeV7pq9W6LWUgqY11kMk2WfPLlO4nFIDq4q4SrLzKFLH0qelotGn+HUcaNK7K1z DJ0b1Q/Yi5Cso98q8ABcX8T4ataEcKIFr0CbSWD0WcGVmEpmaekors87UySsX1aLl0QZ Plsu5fVLlEfin4flJJd0zJVZDR97I+AmQNfywPhs0C6MOTK4K3vWMY8Q/6a9crTxxnbY HvnoMTUpRorv0bDDjvdqMSqdApdn5a5HAeEDvjc1EQrNRlOyxJGwBuh5LwPfmy+LIpey AWJnSdVTfLS85+b0d5Xs0k7+PzFLLhI3PaaLeR8KSIMCOBJf6jCcCBWd3Gle70wzr0qq TELQ== 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 f5-v6si6622251plf.223.2018.03.16.09.48.40; Fri, 16 Mar 2018 09:48:54 -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 S933753AbeCPPf1 (ORCPT + 99 others); Fri, 16 Mar 2018 11:35:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39820 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933738AbeCPPfW (ORCPT ); Fri, 16 Mar 2018 11:35:22 -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 009FB108A; Fri, 16 Mar 2018 15:35:21 +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.14 037/109] staging: rtl8822be: fix missing null check on dev_alloc_skb return Date: Fri, 16 Mar 2018 16:23:06 +0100 Message-Id: <20180316152331.960159777@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@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.14-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))