]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cxgbei: Fix a race between transfer setup and a peer reset.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 20 May 2021 23:03:19 +0000 (16:03 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 28 May 2021 23:47:04 +0000 (16:47 -0700)
commitf949967c8eb3ab5e5a965e3cf07a726dfdc81263
tree84a8824f6638f1b3b7597b36ae067ffb8d2ec4d6
parent67360f7bb0bb575d823c21420abaf165ecf62066
cxgbei: Fix a race between transfer setup and a peer reset.

In 4427ac3675f9, the TOM driver stopped sending work requests to
program iSCSI page pods directly and instead queued them to be written
asynchronously with iSCSI PDUs.  The queue of mbufs to send is
protected by the inp lock.  However, the inp cannot be safely obtained
from the toep since a RST from the remote peer might have cleared
toep->inp asynchronously in an ithread.  To fix, obtain the inp from
the socket as is already done in icl_cxgbei_conn_pdu_queue_cb() and
fail the new transfer setup with ECONNRESET if the connection has been
reset.

To avoid passing sockets or inps into the page pod routines, pull the
mbufq out of the two relevant page pod routines such that the routines
queue new work request mbufs to a caller-supplied mbufq.

Reported by: Jithesh Arakkan @ Chelsio
Fixes: 4427ac3675f91df039d54a23518132e0e0fede86
sys/dev/cxgbe/cxgbei/icl_cxgbei.c
sys/dev/cxgbe/tom/t4_ddp.c
sys/dev/cxgbe/tom/t4_tom.h