anolis-cloud-kernel/drivers/media/dvb-core
Takashi Iwai cb3b7d20ce media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*()
ANBZ: #5893

commit b8c75e4a1b upstream.

Using a semaphore in the wait_event*() condition is no good idea.
It hits a kernel WARN_ON() at prepare_to_wait_event() like:
  do not call blocking ops when !TASK_RUNNING; state=1 set at
  prepare_to_wait_event+0x6d/0x690

For avoiding the potential deadlock, rewrite to an open-coded loop
instead.  Unlike the loop in wait_event*(), this uses wait_woken()
after the condition check, hence the task state stays consistent.

CVE-2023-31084 was assigned to this bug.

Link: https://lore.kernel.org/r/CA+UBctCu7fXn4q41O_3=id1+OdyQ85tZY1x+TkT-6OVBL6KAUw@mail.gmail.com/

Link: https://lore.kernel.org/linux-media/20230512151800.1874-1-tiwai@suse.de
Reported-by: Yu Hao <yhao016@ucr.edu>
Closes: https://nvd.nist.gov/vuln/detail/CVE-2023-31084
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

Fixes: CVE-2023-31084
Signed-off-by: Bo Liu <liubo03@inspur.com>
Reviewed-by: Xunlei Pang <xlpang@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/1908
2023-07-24 07:00:35 +00:00
..
Kconfig media: dvb-core: allow users to enable DVB net ULE debug 2017-12-19 06:29:27 -05:00
Makefile media: dvb: fix DVB_MMAP symbol name 2018-02-23 05:20:01 -05:00
dmxdev.c media: dvb-core: Fix UAF due to refcount races at releasing 2023-02-02 08:54:23 +00:00
dvb_ca_en50221.c media: dvb_ca_en50221: off by one in dvb_ca_en50221_io_do_ioctl() 2018-08-02 14:21:39 -04:00
dvb_demux.c treewide: Use array_size() in vmalloc() 2018-06-12 16:19:22 -07:00
dvb_frontend.c media: dvb-core: Fix kernel WARNING for blocking operation in wait_event*() 2023-07-24 07:00:35 +00:00
dvb_math.c media: move dvb kAPI headers to include/media 2017-12-28 13:16:01 -05:00
dvb_net.c media: dvb_net: fix dvb_net_tx()'s return type 2018-05-05 10:21:40 -04:00
dvb_ringbuffer.c docs: Fix some broken references 2018-06-15 18:10:01 -03:00
dvb_vb2.c media: dvb: update buffer mmaped flags and frame counter 2018-02-23 11:44:08 -05:00
dvbdev.c media: dvb-core: fix a memory leak bug 2019-10-05 13:09:47 +02:00