]> git.baikalelectronics.ru Git - kernel.git/commit
IB/rxe: don't crash, if allocation of crc algorithm failed
authorThomas Bogendoerfer <tbogendoerfer@suse.de>
Tue, 31 Oct 2017 10:16:46 +0000 (11:16 +0100)
committerDoug Ledford <dledford@redhat.com>
Fri, 10 Nov 2017 18:43:50 +0000 (13:43 -0500)
commit7607df762c63e1ca85fd6c8b6e4639502e3ee188
tree9b1914c7fc770ca7b3c8ff51f9098394afcdc10d
parent06521991608cf53955b1088e17a00a7a6d49ba78
IB/rxe: don't crash, if allocation of crc algorithm failed

Following crash happens, if crc algorithm couldn't be allocated:

[ 1087.989072] rdma_rxe: loaded
[ 1097.855397] PCLMULQDQ-NI instructions are not detected.
[ 1097.901220] rdma_rxe: failed to allocate crc algorithmi err:-2
[ 1097.901248] BUG: unable to handle kernel
[ 1097.901249] NULL pointer dereference
[ 1097.901250]  at 0000000000000046
[...]

Reason is that rxe->tfm is assigned the error return, which will then
be used for crypto_free_shash() in rxe_cleanup. Fix by using a
temporary variable and assigning it rxe->tfm after allocation succeeded.

Fixes: 5e2088d0e821 ("IB/rxe: Offload CRC calculation when possible")
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Moni Shoua <monis@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rxe/rxe_verbs.c