sound: usb: qmi: Prevent Null pointer deference due to connect/disconnect
Currently the sound driver uses qmi workqueues for any qmi request sequences to execute, however while doing fast disconnect/connect there is a possbility that the worker thread race between each other which might lead to a scenario where in between the connect sequence the disconnect might interfere and the endpoint might get freed. This might lead to a null pointer deferences in the process used by the hcd. Fix this by making use of the chip-s usage_count to serialize these processes. The disconnect in card drvier will wait for the usage_count to be decreased to 0 in order to execute the disconnect sequences which woudl make sure that the connect runs completely before disconnect. Change-Id: I2a996a5bd6a451fdffdd3d09ba62770e3779f3f4 Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
This commit is contained in:
parent
8e5bdd9685
commit
3b14c6f914
@ -1558,7 +1558,7 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle,
|
||||
}
|
||||
|
||||
uadev[pcm_card_num].ctrl_intf = chip->ctrl_intf;
|
||||
|
||||
atomic_inc(&chip->usage_count);
|
||||
if (req_msg->enable) {
|
||||
ret = enable_audio_stream(subs,
|
||||
map_pcm_format(req_msg->audio_format),
|
||||
@ -1594,6 +1594,8 @@ static void handle_uaudio_stream_req(struct qmi_handle *handle,
|
||||
disable_audio_stream(subs);
|
||||
}
|
||||
|
||||
atomic_dec(&chip->usage_count);
|
||||
|
||||
response:
|
||||
if (!req_msg->enable && ret != -EINVAL && ret != -ENODEV) {
|
||||
if (info_idx >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user