RDMA/cm: Fix an error check in cm_alloc_id_priv()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 7 Apr 2020 09:37:14 +0000 (12:37 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 May 2020 06:15:13 +0000 (08:15 +0200)
commit92c99197815dd2ef166bbe84b780309681fb4631
tree5deb1c1b4d911ef5c95c00f4be5386e01f2d50a2
parent4c499dafdd63a46b26d2eb2391cbfce293a7504b
RDMA/cm: Fix an error check in cm_alloc_id_priv()

commit 983653515849fb56b78ce55d349bb384d43030f6 upstream.

The xa_alloc_cyclic_irq() function returns either 0 or 1 on success and
negatives on error.  This code treats 1 as an error and returns ERR_PTR(1)
which will cause an Oops in the caller.

Fixes: ae78ff3a0f0c ("RDMA/cm: Convert local_id_table to XArray")
Link: https://lore.kernel.org/r/20200407093714.GA80285@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/core/cm.c