linux-stable/arch/xtensa
Duoming Zhou 50f79a2abb arch: xtensa: platforms: Fix deadlock in rs_close()
[ Upstream commit eb5adc7075 ]

There is a deadlock in rs_close(), which is shown
below:

   (Thread 1)              |      (Thread 2)
                           | rs_open()
rs_close()                 |  mod_timer()
 spin_lock_bh() //(1)      |  (wait a time)
 ...                       | rs_poll()
 del_timer_sync()          |  spin_lock() //(2)
 (wait timer to stop)      |  ...

We hold timer_lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need timer_lock in position (2) of thread 2.
As a result, rs_close() will block forever.

This patch deletes the redundant timer_lock in order to
prevent the deadlock. Because there is no race condition
between rs_close, rs_open and rs_poll.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Message-Id: <20220407154430.22387-1-duoming@zju.edu.cn>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-05-09 09:14:40 +02:00
..
boot xtensa: fix DTC warning unit_address_format 2022-04-13 20:59:09 +02:00
configs drivers/char: remove /dev/kmem for good 2021-05-07 00:26:34 -07:00
include xtensa: fix xtensa_wsr always writing 0 2022-04-08 14:23:03 +02:00
kernel xtensa: fix a7 clobbering in coprocessor context load/store 2022-04-27 14:38:59 +02:00
lib xtensa: propagate the calling conventions change down into csum_partial_copy_generic() 2020-08-20 15:45:21 -04:00
mm xtensa: define update_mmu_tlb function 2022-04-08 14:23:03 +02:00
platforms arch: xtensa: platforms: Fix deadlock in rs_close() 2022-05-09 09:14:40 +02:00
variants xtensa: add test_kc705_be variant 2018-08-20 12:34:45 -07:00
Kbuild xtensa: move core-y in arch/xtensa/Makefile to arch/xtensa/Kbuild 2021-08-11 11:37:13 -07:00
Kconfig Tracing updates for 5.15: 2021-09-05 11:50:41 -07:00
Kconfig.debug xtensa: make stack dump size configurable 2019-11-26 11:33:39 -08:00
Makefile xtensa: move core-y in arch/xtensa/Makefile to arch/xtensa/Kbuild 2021-08-11 11:37:13 -07:00