lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211205183810.8299-1-amhamza.mgc@gmail.com>
Date:   Sun,  5 Dec 2021 23:38:10 +0500
From:   Ameer Hamza <amhamza.mgc@...il.com>
To:     jeroendb@...gle.com, csully@...gle.com, awogbemila@...gle.com,
        davem@...emloft.net, kuba@...nel.org, bcf@...gle.com,
        willemb@...gle.com
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        amhamza.mgc@...il.com
Subject: [PATCH v2] gve: fix for null pointer dereference.

Avoid passing NULL skb to __skb_put() function call if
napi_alloc_skb() returns NULL.

Addresses-Coverity: 1494144 (Dereference NULL return value)

Signed-off-by: Ameer Hamza <amhamza.mgc@...il.com>

---
Change in v2:
checking for correct skb pointer for NULL check
---
 drivers/net/ethernet/google/gve/gve_utils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/google/gve/gve_utils.c b/drivers/net/ethernet/google/gve/gve_utils.c
index 88ca49cbc1e2..d57508bc4307 100644
--- a/drivers/net/ethernet/google/gve/gve_utils.c
+++ b/drivers/net/ethernet/google/gve/gve_utils.c
@@ -68,6 +68,9 @@ struct sk_buff *gve_rx_copy(struct net_device *dev, struct napi_struct *napi,
 		set_protocol = ctx->curr_frag_cnt == ctx->expected_frag_cnt - 1;
 	} else {
 		skb = napi_alloc_skb(napi, len);
+
+		if (unlikely(!skb))
+			return NULL;
 		set_protocol = true;
 	}
 	__skb_put(skb, len);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ