netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/smc: fix kernel panic caused by race of smc_sock
@ 2021-12-28  9:03 Dust Li
  2021-12-28  9:03 ` [PATCH net 1/2] net/smc: don't send CDC/LLC message if link not ready Dust Li
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Dust Li @ 2021-12-28  9:03 UTC (permalink / raw)
  To: Karsten Graul, David S . Miller, Jakub Kicinski
  Cc: linux-s390, netdev, Wen Gu, Tony Lu

This patchset fixes the race between smc_release triggered by
close(2) and cdc_handle triggered by underlaying RDMA device.

The race is caused because the smc_connection may been released
before the pending tx CDC messages got its CQEs. In order to fix
this, I add a counter to track how many pending WRs we have posted
through the smc_connection, and only release the smc_connection
after there is no pending WRs on the connection.

The first patch prevents posting WR on a QP that is not in RTS
state. This patch is needed because if we post WR on a QP that
is not in RTS state, ib_post_send() may success but no CQE will
return, and that will confuse the counter tracking the pending
WRs.

The second patch add a counter to track how many WRs were posted
through the smc_connection, and don't reset the QP on link destroying
to prevent leak of the counter.

Dust Li (2):
  net/smc: don't send CDC/LLC message if link not ready
  net/smc: fix kernel panic caused by race of smc_sock

 net/smc/smc.h      |  5 +++++
 net/smc/smc_cdc.c  | 52 +++++++++++++++++++++-------------------------
 net/smc/smc_cdc.h  |  2 +-
 net/smc/smc_core.c | 27 ++++++++++++++++++------
 net/smc/smc_core.h |  6 ++++++
 net/smc/smc_ib.c   |  4 ++--
 net/smc/smc_ib.h   |  1 +
 net/smc/smc_llc.c  |  2 +-
 net/smc/smc_wr.c   | 45 +++++----------------------------------
 net/smc/smc_wr.h   |  5 ++---
 10 files changed, 68 insertions(+), 81 deletions(-)

-- 
2.19.1.3.ge56e4f7


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-01-03 10:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-28  9:03 [PATCH net 0/2] net/smc: fix kernel panic caused by race of smc_sock Dust Li
2021-12-28  9:03 ` [PATCH net 1/2] net/smc: don't send CDC/LLC message if link not ready Dust Li
2021-12-29 12:36   ` Karsten Graul
2021-12-30  3:02     ` dust.li
2021-12-30 18:55       ` Karsten Graul
2021-12-31  3:15         ` dust.li
2022-01-03 10:40           ` Karsten Graul
2021-12-31  6:08   ` [PATCH net] net/smc: add comments for smc_link_{usable|sendable} Dust Li
2022-01-02 16:20     ` patchwork-bot+netdevbpf
2021-12-28  9:03 ` [PATCH net 2/2] net/smc: fix kernel panic caused by race of smc_sock Dust Li
2021-12-29 12:33   ` Karsten Graul
2021-12-30  3:46     ` dust.li
2021-12-28 12:50 ` [PATCH net 0/2] " patchwork-bot+netdevbpf

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).