mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
ALSA: mixart: Fix mutex deadlock
commitd21b96c8ed
upstream. The code change for switching to non-atomic mode brought the unexpected mutex deadlock in get_msg(). It converted the spinlock with the existing mutex, but there were calls with the already holding the mutex. Since the only place that needs the extra lock is the code path from snd_mixart_send_msg(), remove the mutex lock in get_msg() and apply in the caller side for fixing the mutex deadlock. Fixes:8d3a8b5cb5
("ALSA: mixart: Use nonatomic PCM ops") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20201119121440.18945-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b9a69e5d0b
commit
c70c1b93f3
1 changed files with 2 additions and 3 deletions
|
@ -70,7 +70,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutex_lock(&mgr->msg_lock);
|
|
||||||
err = 0;
|
err = 0;
|
||||||
|
|
||||||
/* copy message descriptor from miXart to driver */
|
/* copy message descriptor from miXart to driver */
|
||||||
|
@ -119,8 +118,6 @@ static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
|
||||||
writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD));
|
writel_be(headptr, MIXART_MEM(mgr, MSG_OUTBOUND_FREE_HEAD));
|
||||||
|
|
||||||
_clean_exit:
|
_clean_exit:
|
||||||
mutex_unlock(&mgr->msg_lock);
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +255,9 @@ int snd_mixart_send_msg(struct mixart_mgr *mgr, struct mixart_msg *request, int
|
||||||
resp.data = resp_data;
|
resp.data = resp_data;
|
||||||
resp.size = max_resp_size;
|
resp.size = max_resp_size;
|
||||||
|
|
||||||
|
mutex_lock(&mgr->msg_lock);
|
||||||
err = get_msg(mgr, &resp, msg_frame);
|
err = get_msg(mgr, &resp, msg_frame);
|
||||||
|
mutex_unlock(&mgr->msg_lock);
|
||||||
|
|
||||||
if( request->message_id != resp.message_id )
|
if( request->message_id != resp.message_id )
|
||||||
dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
|
dev_err(&mgr->pci->dev, "RESPONSE ERROR!\n");
|
||||||
|
|
Loading…
Reference in a new issue