Skip to content

Commit 12e5eef

Browse files
BernardMetzlerjgunthorpe
authored andcommitted
RDMA/siw: Fix failure handling during device creation
A failing call to ib_device_set_netdev() during device creation caused system crash due to xa_destroy of uninitialized xarray hit by device deallocation. Fixed by moving xarray initialization before potential device deallocation. Fixes: bdcf26b ("rdma/siw: network and RDMA core interface") Link: https://lore.kernel.org/r/[email protected] Reported-by: [email protected] Signed-off-by: Bernard Metzler <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 78f34a1 commit 12e5eef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/infiniband/sw/siw/siw_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
388388
{ .max_segment_size = SZ_2G };
389389
base_dev->num_comp_vectors = num_possible_cpus();
390390

391+
xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
392+
xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
393+
391394
ib_set_device_ops(base_dev, &siw_device_ops);
392395
rv = ib_device_set_netdev(base_dev, netdev, 1);
393396
if (rv)
@@ -415,9 +418,6 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
415418
sdev->attrs.max_srq_wr = SIW_MAX_SRQ_WR;
416419
sdev->attrs.max_srq_sge = SIW_MAX_SGE;
417420

418-
xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
419-
xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
420-
421421
INIT_LIST_HEAD(&sdev->cep_list);
422422
INIT_LIST_HEAD(&sdev->qp_list);
423423

0 commit comments

Comments
 (0)