Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: hci_sync: call destroy in hci_cmd_sync_run if immediate

hci_cmd_sync_run() may run the work immediately if called from existing
sync work (otherwise it queues a new sync work). In this case it fails
to call the destroy() function.

On immediate run, make it behave same way as if item was queued
successfully: call destroy, and return 0.

The only callsite is hci_abort_conn() via hci_cmd_sync_run_once(), and
this changes its return value. However, its return value is not used
except as the return value for hci_disconnect(), and nothing uses the
return value of hci_disconnect(). Hence there should be no behavior
change anywhere.

Fixes: c898f6d7b093b ("Bluetooth: hci_sync: Introduce hci_cmd_sync_run/hci_cmd_sync_run_once")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Pauli Virtanen and committed by
Luiz Augusto von Dentz
a834a0b6 48b3cd69

+9 -2
+9 -2
net/bluetooth/hci_sync.c
··· 801 801 return -ENETDOWN; 802 802 803 803 /* If on cmd_sync_work then run immediately otherwise queue */ 804 - if (current_work() == &hdev->cmd_sync_work) 805 - return func(hdev, data); 804 + if (current_work() == &hdev->cmd_sync_work) { 805 + int err; 806 + 807 + err = func(hdev, data); 808 + if (destroy) 809 + destroy(hdev, data, err); 810 + 811 + return 0; 812 + } 806 813 807 814 return hci_cmd_sync_submit(hdev, func, data, destroy); 808 815 }