]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
authorColin Ian King <colin.king@canonical.com>
Sat, 13 Apr 2019 16:00:26 +0000 (17:00 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 13 Aug 2019 12:11:36 +0000 (14:11 +0200)
BugLink: https://bugs.launchpad.net/bugs/1837517
[ Upstream commit a6d2a5a92e67d151c98886babdc86d530d27111c ]

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>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/infiniband/hw/cxgb4/cm.c

index 25a81fbb0d4d5af2e50bcb428ce9a51ad40139be..f1819b5272560981d5937704d1f6308128b1f1e5 100644 (file)
@@ -457,6 +457,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;