RDMA/siw: Fix SQ/RQ drain logic
authorBernard Metzler <bmt@zurich.ibm.com>
Fri, 4 Oct 2019 12:53:56 +0000 (14:53 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 22 Oct 2019 16:43:10 +0000 (13:43 -0300)
commitcf049bb31f7101d9672eaf97ade4fdd5171ddf26
treeec34cda94a0a96727517047b36929af1bced3a7f
parent5a0d523781075529e9c2ff3ba7312ddf4e32609a
RDMA/siw: Fix SQ/RQ drain logic

Storage ULPs (e.g. iSER & NVMeOF) use ib_drain_qp() to drain
QP/CQ. Current SIW's own drain routines do not properly wait until all
SQ/RQ elements are completed and reaped from the CQ. This may cause touch
after free issues.  New logic relies on generic
__ib_drain_sq()/__ib_drain_rq() posting a final work request, which SIW
immediately flushes to CQ.

Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
Link: https://lore.kernel.org/r/20191004125356.20673-1-bmt@zurich.ibm.com
Signed-off-by: Krishnamraju Eraparaju <krishna2@chelsio.com>
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/sw/siw/siw_main.c
drivers/infiniband/sw/siw/siw_verbs.c