public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference
@ 2019-03-19 20:21 Aditya Pakki
  2019-03-20  7:23 ` Greg Kroah-Hartman
  2019-03-20  7:24 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-03-19 20:21 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Greg Kroah-Hartman, Nathan Chancellor, Sabin Mihai Rapan,
	devel, linux-kernel

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.

---
v1: Patch collision with rtl_phydm.c, fix as per Greg
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 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 f061dd1382aa..cf6b7a80b753 100644
--- a/drivers/staging/rtlwifi/rtl8822be/fw.c
+++ b/drivers/staging/rtlwifi/rtl8822be/fw.c
@@ -743,6 +743,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.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference
  2019-03-19 20:21 [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference Aditya Pakki
@ 2019-03-20  7:23 ` Greg Kroah-Hartman
  2019-03-20  7:24 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-20  7:23 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: devel, kjlu, linux-kernel, Sabin Mihai Rapan, Nathan Chancellor

On Tue, Mar 19, 2019 at 03:21:25PM -0500, Aditya Pakki wrote:
> 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.
> 
> ---
> v1: Patch collision with rtl_phydm.c, fix as per Greg
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Same here, has to be above.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference
  2019-03-19 20:21 [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference Aditya Pakki
  2019-03-20  7:23 ` Greg Kroah-Hartman
@ 2019-03-20  7:24 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-20  7:24 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: devel, kjlu, linux-kernel, Sabin Mihai Rapan, Nathan Chancellor

On Tue, Mar 19, 2019 at 03:21:25PM -0500, Aditya Pakki wrote:
> 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.
> 
> ---
> v1: Patch collision with rtl_phydm.c, fix as per Greg
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

And here as well, please put above ---


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-20  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19 20:21 [PATCH v2] staging: rtlwifi: rtl8822b: fix to avoid NULL pointer dereference Aditya Pakki
2019-03-20  7:23 ` Greg Kroah-Hartman
2019-03-20  7:24 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox