]> git.baikalelectronics.ru Git - kernel.git/commit
Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 13 Sep 2022 23:08:13 +0000 (16:08 -0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 15 Sep 2022 21:07:59 +0000 (14:07 -0700)
commitfe5aea00391977b5aab6a3606a639923127681d3
treea5348faefef4e12ff8cc766fc3a903463be0b36e
parent220b94577914075bfe2f801d970574851ebaaf08
Bluetooth: RFCOMM: Fix possible deadlock on socket shutdown/release

Due to change to switch to use lock_sock inside rfcomm_sk_state_change
the socket shutdown/release procedure can cause a deadlock:

    rfcomm_sock_shutdown():
      lock_sock();
      __rfcomm_sock_close():
        rfcomm_dlc_close():
          __rfcomm_dlc_close():
            rfcomm_dlc_lock();
            rfcomm_sk_state_change():
              lock_sock();

To fix this when the call __rfcomm_sock_close is now done without
holding the lock_sock since rfcomm_dlc_lock exists to protect
the dlc data there is no need to use lock_sock in that code path.

Link: https://lore.kernel.org/all/CAD+dNTsbuU4w+Y_P7o+VEN7BYCAbZuwZx2+tH+OTzCdcZF82YA@mail.gmail.com/
Fixes: 0df26646a4df ("Bluetooth: switch to lock_sock in RFCOMM")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/rfcomm/sock.c