netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 3.18 01/15] qlcnic: Avoid potential NULL pointer dereference
@ 2019-04-22 19:50 Sasha Levin
  2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 04/15] net: ks8851: Dequeue RX packets explicitly Sasha Levin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sasha Levin @ 2019-04-22 19:50 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Aditya Pakki, David S . Miller, Sasha Levin, netdev

From: Aditya Pakki <pakki001@umn.edu>

[ Upstream commit 5bf7295fe34a5251b1d241b9736af4697b590670 ]

netdev_alloc_skb can fail and return a NULL pointer which is
dereferenced without a check. The patch avoids such a scenario.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 0a2318cad34d..63ebc491057b 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1038,6 +1038,8 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
 
 	for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
 		skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
+		if (!skb)
+			break;
 		qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
 		skb_put(skb, QLCNIC_ILB_PKT_SIZE);
 		adapter->ahw->diag_cnt = 0;
-- 
2.19.1


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

end of thread, other threads:[~2019-04-22 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22 19:50 [PATCH AUTOSEL 3.18 01/15] qlcnic: Avoid potential NULL pointer dereference Sasha Levin
2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 04/15] net: ks8851: Dequeue RX packets explicitly Sasha Levin
2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 05/15] net: ks8851: Reassert reset pin if chip ID check fails Sasha Levin
2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 06/15] net: ks8851: Delay requesting IRQ until opened Sasha Levin
2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 07/15] net: ks8851: Set initial carrier state to down Sasha Levin
2019-04-22 19:50 ` [PATCH AUTOSEL 3.18 08/15] net: ibm: fix possible object reference leak Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).