summaryrefslogtreecommitdiff
path: root/mm/workingset.c
diff options
context:
space:
mode:
authorChengfeng Ye <dg573847474@gmail.com>2023-07-28 12:39:01 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-04 15:05:56 +0200
commit8b66eec1fd85ca9c4fd83f92e704de4fc0c583c1 (patch)
tree1cba8c52fc5ee1c0700354dc40698a1d6e9114c0 /mm/workingset.c
parentf68279ca7f806c44fbbae0a631e5603ba426d9be (diff)
tty: synclink_gt: Fix potential deadlock on &info->lock
As &info->lock is acquired by slgt_interrupt() under irq context, other process context code acquiring the lock should disable irq, otherwise deadlock could happen if the irq preempt the execution while the lock is held in process context on the same CPU. Lock acquisition inside set_params32() does not disable irq, and this function is called by slgt_compat_ioctl() from process context. Possible deadlock scenario: slgt_compat_ioctl() -> set_params32() -> spin_lock(&info->lock) <irq> -> slgt_interrupt() -> spin_lock(&info->lock); (deadlock here) This flaw was found by an experimental static analysis tool I am developing for irq-related deadlock. x86_64 allmodconfig using gcc shows no new warning. The patch fixes the potential deadlock by spin_lock_irqsave() like other lock acquisition sites. Signed-off-by: Chengfeng Ye <dg573847474@gmail.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230728123901.64225-1-dg573847474@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/workingset.c')
0 files changed, 0 insertions, 0 deletions