public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Chengfeng Ye <dg573847474@gmail.com>,
	gregkh@linuxfoundation.org, ilpo.jarvinen@linux.intel.com,
	bhelgaas@google.com, russell.h.weight@intel.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: synclink_gt: Fix potential deadlock on &info->lock
Date: Mon, 31 Jul 2023 07:40:38 +0200	[thread overview]
Message-ID: <75f58741-a18d-2e92-ecb3-8f997a3ef404@kernel.org> (raw)
In-Reply-To: <20230728123901.64225-1-dg573847474@gmail.com>

On 28. 07. 23, 14:39, Chengfeng Ye wrote:
> 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>

Oh well, this driver deserves to die (or a massive rewrite).

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

thanks,
-- 
js
suse labs


  reply	other threads:[~2023-07-31  5:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28 12:39 [PATCH] tty: synclink_gt: Fix potential deadlock on &info->lock Chengfeng Ye
2023-07-31  5:40 ` Jiri Slaby [this message]
     [not found] ` <a95e699c-c507-931e-92b0-7f63a5e3a9e1@web.de>
2023-07-31 13:22   ` Greg Kroah-Hartman

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=75f58741-a18d-2e92-ecb3-8f997a3ef404@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dg573847474@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=russell.h.weight@intel.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