Commit 1fc671b3 authored by Thomas Pugliese's avatar Thomas Pugliese Committed by Greg Kroah-Hartman

uwb: move mutex_lock to error case in uwbd_evt_handle_rc_bp_slot_change

Only acquire rc->uwb_dev.mutex in the error case in
uwbd_evt_handle_rc_bp_slot_change.  This fixes a bug where establishing
a reservation on a new channel will fail if we were unable to establish
a reservation on the previous channel due to DRP conflict.

If rc->uwb_dev.mutex is acquired in the non-error case when the uwb
system is attempting to start beaconing, it will block because the start
beaconing code is holding this mutex.  This prevents any other
notifications from the URC from being processed.  In particular, the
DRP_AVAILABILITY notification will not be processed during the start
beaconing process which can result in a failure to establish a
reservation.  It is safe to not hold the mutex in the non-error
case since the only other place rc->uwb_dev.beacon_slot is accessed is
in the same worker thread that uwbd_evt_handle_rc_bp_slot_change
executes in.
Signed-off-by: default avatarThomas Pugliese <thomas.pugliese@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bf359dff
...@@ -516,13 +516,13 @@ int uwbd_evt_handle_rc_bp_slot_change(struct uwb_event *evt) ...@@ -516,13 +516,13 @@ int uwbd_evt_handle_rc_bp_slot_change(struct uwb_event *evt)
} }
bpsc = container_of(evt->notif.rceb, struct uwb_rc_evt_bp_slot_change, rceb); bpsc = container_of(evt->notif.rceb, struct uwb_rc_evt_bp_slot_change, rceb);
mutex_lock(&rc->uwb_dev.mutex);
if (uwb_rc_evt_bp_slot_change_no_slot(bpsc)) { if (uwb_rc_evt_bp_slot_change_no_slot(bpsc)) {
dev_err(dev, "stopped beaconing: No free slots in BP\n"); dev_err(dev, "stopped beaconing: No free slots in BP\n");
mutex_lock(&rc->uwb_dev.mutex);
rc->beaconing = -1; rc->beaconing = -1;
mutex_unlock(&rc->uwb_dev.mutex);
} else } else
rc->uwb_dev.beacon_slot = uwb_rc_evt_bp_slot_change_slot_num(bpsc); rc->uwb_dev.beacon_slot = uwb_rc_evt_bp_slot_change_slot_num(bpsc);
mutex_unlock(&rc->uwb_dev.mutex);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment