From: Takashi Iwai <tiwai@suse.de>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, rfontana@redhat.com,
gregkh@linuxfoundation.org, allison@lohutok.net,
tglx@linutronix.de, alsa-devel@alsa-project.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] ALSA: seq: a possible sleep-in-atomic-context bug in snd_virmidi_dev_receive_event()
Date: Tue, 17 Dec 2019 14:37:56 +0100 [thread overview]
Message-ID: <s5hh81z9iob.wl-tiwai@suse.de> (raw)
In-Reply-To: <db47108d-3967-6760-3de2-17bf60741bc2@gmail.com>
On Tue, 17 Dec 2019 14:24:21 +0100,
Jia-Ju Bai wrote:
>
> The driver may sleep while holding a read lock.
> The function call path (from bottom to top) in Linux 4.19 is:
>
> sound/core/seq/seq_memory.c, 96:
> copy_from_user in snd_seq_dump_var_event
> sound/core/seq/seq_virmidi.c, 97:
> snd_seq_dump_var_event in snd_virmidi_dev_receive_event
> sound/core/seq/seq_virmidi.c, 88:
> _raw_read_lock in snd_virmidi_dev_receive_event
This can't happen. snd_virmidi_dev_receive_event() takes
conditionally either read_lock or rw_sem depending on the atomic
argument. And the data including user-space pointer is handled always
with atomic=1, hence down_read() is used instead of read_lock() here.
thanks,
Takashi
> copy_from_user() can sleep at runtime.
>
> I am not sure how to properly fix this possible bug, so I only report it.
>
> This bug is found by a static analysis tool STCheck written by myself.
>
>
> Best wishes,
> Jia-Ju Bai
>
next prev parent reply other threads:[~2019-12-17 13:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 13:24 Jia-Ju Bai
2019-12-17 13:30 ` Greg KH
2019-12-17 13:37 ` Takashi Iwai [this message]
2019-12-17 13:39 ` Jia-Ju Bai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hh81z9iob.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=allison@lohutok.net \
--cc=alsa-devel@alsa-project.org \
--cc=baijiaju1990@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=rfontana@redhat.com \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®