mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
[ Upstream commita6d2a5a92e] Currently if alloc_skb fails to allocate the skb a null skb is passed to t4_set_arp_err_handler and this ends up dereferencing the null skb. Avoid the NULL pointer dereference by checking for a NULL skb and returning early. Addresses-Coverity: ("Dereference null return") Fixes:b38a0ad8ec("RDMA/cxgb4: Set arp error handler for PASS_ACCEPT_RPL messages") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Potnuri Bharat Teja <bharat@chelsio.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
fcc6b2459e
commit
ffa61ab75c
@@ -456,6 +456,8 @@ static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp)
|
||||
skb_reset_transport_header(skb);
|
||||
} else {
|
||||
skb = alloc_skb(len, gfp);
|
||||
if (!skb)
|
||||
return NULL;
|
||||
}
|
||||
t4_set_arp_err_handler(skb, NULL, NULL);
|
||||
return skb;
|
||||
|
||||
Reference in New Issue
Block a user