]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cxgbe/iw_cxgbe: fix various double-close panics with iWARP sockets.
authorNavdeep Parhar <np@FreeBSD.org>
Tue, 28 Feb 2017 19:27:41 +0000 (19:27 +0000)
committerNavdeep Parhar <np@FreeBSD.org>
Tue, 28 Feb 2017 19:27:41 +0000 (19:27 +0000)
commit017296dbb60f2f18cd11e8f20c31c43eabfa1320
tree446e72cd7fd958220b85a444c053820a8b44817f
parentd5d965424f943b6bc7f6c7a7a12e1174fd340cc7
cxgbe/iw_cxgbe: fix various double-close panics with iWARP sockets.

Sockets representing the TCP endpoints for iWARP connections are
allocated by the ibcore module.  Before this revision they were closed
either by the ibcore module or the iw_cxgbe hardware driver depending on
the state transitions during connection teardown.  This is error prone
and there were cases where both iw_cxgbe and ibcore closed the socket
leading to double-free panics.  The fix is to let ibcore close the
sockets it creates and never do it in the driver.

- Use sodisconnect instead of soclose (preceded by solinger = 0) in the
  driver to tear down an RDMA connection abruptly.  This does what's
  intended without releasing the socket's fd reference.

- Close the socket in ibcore when the iWARP iw_cm_id is destroyed.  This
  works for all kinds of sockets: clients that initiate connections,
  listeners, and sockets accepted off of listeners.

Reviewed by: Steve Wise @ Open Grid Computing, hselasky@
MFC after: 3 days
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D9796
sys/dev/cxgbe/iw_cxgbe/cm.c
sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
sys/ofed/drivers/infiniband/core/cma.c
sys/ofed/drivers/infiniband/core/iwcm.c