Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2843812yba; Mon, 22 Apr 2019 14:07:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjgOe3ZaszbqNOLcCqM1RwpUvlm9/OHL0ICSaADEgzLdR6mjc+ax83cycti+rgqYYSgb3v X-Received: by 2002:a62:e710:: with SMTP id s16mr22379462pfh.74.1555967238183; Mon, 22 Apr 2019 14:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555967238; cv=none; d=google.com; s=arc-20160816; b=g9kEn/fnqK5eGlFjwEuS10Djz0PH8Ck6RJAc5GWqaitxqTiT08+IkFBc8Gsg9hI5Cn 5ike6sBUUfpcjMt9FOb+Z7f1QuRfQs92tNNifYdQD/HATuOfvMdgWU+rtwm6ItLM0sTl 56KCfgwVy+7ZrE0ESvX+g8Uja2uv/m2CEXwq5pajf4OREvebr7XvkLb5vUtN1jvTBcsl f+30541c8P1gh/4y2wxsio1Rba8TAMjVFsXD/bNYDjLRdcMpEogqT8ZXHLdhLVrt2lJz wOfeYu0J3v37Gl8Ea9ZRtK7Gz8ByBgL+WTeixJg403AyBoWjsNbRVhTNcHbb2zzaupyY A51A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M8k/G2P1CXJVsAK9sxswYHQHdF0G9+iSLVNPFMTv/2A=; b=d6SpQ5Mks6ZVS+j9Z/WXgvGfBWa8PPHfBBuaoq2lZLCK1JGsCWnXlNFM4RrtW4RmTw MRmq+9aa1VnfLnRUopyBdvfTSjwh6NItDhRE4EE2vUyBfSLkRhO71TVOs03oA6R2Jkl/ sXNhSjqZVMsCu479NQ2VCNyAXtt13mVsIfcgn6dJWkF26Ehie/WbBJh1iRKU/EOQ0qqq OntKsX15DnN/Z4oQI3SSe7HLk+a3ufzYqrt+E6HSmVHTUwulClbAK0xp0IOaeNq7473N ja+HmQhTM/18vZ8BSli92Qu6A9JNfj+G4T27O5mBzkmIizqDYcaeZVPIDvU4yC0J+h9i xATw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gP1aAVH4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si14075783pfr.47.2019.04.22.14.07.03; Mon, 22 Apr 2019 14:07:18 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gP1aAVH4; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729576AbfDVTqb (ORCPT + 99 others); Mon, 22 Apr 2019 15:46:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:48770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729986AbfDVTqa (ORCPT ); Mon, 22 Apr 2019 15:46:30 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D952E21905; Mon, 22 Apr 2019 19:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962389; bh=7j3E1e+lrmReu26Do7xLFUPEL1t3n89IHvS62UC5CGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gP1aAVH4QnS70ZPWLBCYkOv6gKREoWNO+oEWRtcEdqQYmFUArusfXob4GMd5KxLbq 1GBtSlgVphxp5RaYkRL41sIrjHcjpaTbT3xjJd+jtK4geEeUkXZdo2uJWJk/ejA5Q4 2fh+jq+OY4gzpltkk0DHi99VWPBGS03bWKmXMRSs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Aditya Pakki , Greg Kroah-Hartman , Sasha Levin , devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 4.19 32/68] staging: rtlwifi: rtl8822b: fix to avoid potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:44:40 -0400 Message-Id: <20190422194516.11634-32-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aditya Pakki [ Upstream commit d70d70aec9632679dd00dcc1b1e8b2517e2c7da0 ] skb allocated via dev_alloc_skb can fail and return a NULL pointer. This patch avoids such a scenario and returns, consistent with other invocations. Signed-off-by: Aditya Pakki Reviewed-by: Mukesh Ojha Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin (Microsoft) --- drivers/staging/rtlwifi/rtl8822be/fw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/rtlwifi/rtl8822be/fw.c b/drivers/staging/rtlwifi/rtl8822be/fw.c index a40396614814..c1ed52df05f0 100644 --- a/drivers/staging/rtlwifi/rtl8822be/fw.c +++ b/drivers/staging/rtlwifi/rtl8822be/fw.c @@ -741,6 +741,8 @@ void rtl8822be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) u1_rsvd_page_loc, 3); skb = dev_alloc_skb(totalpacketlen); + if (!skb) + return; memcpy((u8 *)skb_put(skb, totalpacketlen), &reserved_page_packet, totalpacketlen); -- 2.19.1