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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:48:23 +0000 (06:48 -0700)
commit3b82ce17cea914ffc53ba15ae7c6f542d4ec6d9c
tree5ad7a0ca0e98340c367c1c64a92721d59d5ddfd0
parent9f641ee2b749d57b4672e4c28f4dba9523923ac4
RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure

[ 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>
drivers/infiniband/hw/cxgb4/cm.c