* [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation
@ 2020-03-02 15:58 Bernard Metzler
2020-03-03 7:22 ` Leon Romanovsky
2020-03-04 18:27 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Bernard Metzler @ 2020-03-02 15:58 UTC (permalink / raw)
To: dledford, jgg, linux-kernel, linux-rdma, netdev, syzkaller-bugs
Cc: Bernard Metzler
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: bdcf26bf9b3a (rdma/siw: network and RDMA core interface)
Reported-by: syzbot+2e80962bedd9559fe0b3@syzkaller.appspotmail.com
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
---
v1 -> v2:
- Fix here only potential system crash during failing device
creation, but not missing correct error propagation.
drivers/infiniband/sw/siw/siw_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index 96ed349c0939..5cd40fb9e20c 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -388,6 +388,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
{ .max_segment_size = SZ_2G };
base_dev->num_comp_vectors = num_possible_cpus();
+ xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
+ xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
+
ib_set_device_ops(base_dev, &siw_device_ops);
rv = ib_device_set_netdev(base_dev, netdev, 1);
if (rv)
@@ -415,9 +418,6 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
sdev->attrs.max_srq_wr = SIW_MAX_SRQ_WR;
sdev->attrs.max_srq_sge = SIW_MAX_SGE;
- xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
- xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
-
INIT_LIST_HEAD(&sdev->cep_list);
INIT_LIST_HEAD(&sdev->qp_list);
--
2.17.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation
2020-03-02 15:58 [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation Bernard Metzler
@ 2020-03-03 7:22 ` Leon Romanovsky
2020-03-04 18:27 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-03-03 7:22 UTC (permalink / raw)
To: Bernard Metzler
Cc: dledford, jgg, linux-kernel, linux-rdma, netdev, syzkaller-bugs
On Mon, Mar 02, 2020 at 04:58:14PM +0100, Bernard Metzler wrote:
> 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: bdcf26bf9b3a (rdma/siw: network and RDMA core interface)
Fixes line should be slightly different.
Fixes: bdcf26bf9b3a ("rdma/siw: network and RDMA core interface")
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation
2020-03-02 15:58 [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation Bernard Metzler
2020-03-03 7:22 ` Leon Romanovsky
@ 2020-03-04 18:27 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-03-04 18:27 UTC (permalink / raw)
To: Bernard Metzler
Cc: dledford, linux-kernel, linux-rdma, netdev, syzkaller-bugs
On Mon, Mar 02, 2020 at 04:58:14PM +0100, Bernard Metzler wrote:
> 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: bdcf26bf9b3a (rdma/siw: network and RDMA core interface)
> Reported-by: syzbot+2e80962bedd9559fe0b3@syzkaller.appspotmail.com
> Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
> ---
> v1 -> v2:
> - Fix here only potential system crash during failing device
> creation, but not missing correct error propagation.
>
> drivers/infiniband/sw/siw/siw_main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Applied to for-rc
Thanks,
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-04 18:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 15:58 [Patch for-rc v2] RDMA/siw: Fix failure handling during device creation Bernard Metzler
2020-03-03 7:22 ` Leon Romanovsky
2020-03-04 18:27 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).