* [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure
@ 2019-04-13 16:00 Colin King
2019-04-15 7:53 ` Potnuri Bharat Teja
2019-04-16 11:06 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-04-13 16:00 UTC (permalink / raw)
To: Potnuri Bharat Teja, Doug Ledford, Jason Gunthorpe, linux-rdma
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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: b38a0ad8ec11 ("RDMA/cxgb4: Set arp error handler for PASS_ACCEPT_RPL messages")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/infiniband/hw/cxgb4/cm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 1e68d87b663d..0f3b1193d5f8 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -460,6 +460,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;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure
2019-04-13 16:00 [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure Colin King
@ 2019-04-15 7:53 ` Potnuri Bharat Teja
2019-04-16 11:06 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Potnuri Bharat Teja @ 2019-04-15 7:53 UTC (permalink / raw)
To: Colin King
Cc: Doug Ledford, Jason Gunthorpe, linux-rdma, kernel-janitors, linux-kernel
On Saturday, April 04/13/19, 2019 at 21:30:26 +0530, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: b38a0ad8ec11 ("RDMA/cxgb4: Set arp error handler for PASS_ACCEPT_RPL messages")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
Thanks,
Acked-by: Potnuri Bharat Teja <bharat@chelsio.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure
2019-04-13 16:00 [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure Colin King
2019-04-15 7:53 ` Potnuri Bharat Teja
@ 2019-04-16 11:06 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2019-04-16 11:06 UTC (permalink / raw)
To: Colin King
Cc: Potnuri Bharat Teja, Doug Ledford, linux-rdma, kernel-janitors,
linux-kernel
On Sat, Apr 13, 2019 at 05:00:26PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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: b38a0ad8ec11 ("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>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 2 ++
> 1 file changed, 2 insertions(+)
Applied to for-next
Thanks,
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-16 11:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-13 16:00 [PATCH] RDMA/cxgb4: fix null pointer dereference on alloc_skb failure Colin King
2019-04-15 7:53 ` Potnuri Bharat Teja
2019-04-16 11:06 ` Jason Gunthorpe
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).