mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Sanan Hasanov <sanan.hasanou@gmail.com>
Cc: Marius Zachmann <mail@mariuszachmann.de>,
	Sanan Hasanov <sanan.hasanov@ucf.edu>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
	Aleksa Savic <savicaleksa83@gmail.com>,
	syzbot+0f98b0c0bdeaab2dc2fd@syzkaller.appspotmail.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] hwmon: (corsair-cpro) Make wait_input_report_lock IRQ safe
Date: Sun, 18 Oct 2026 09:33:10 -0700	[thread overview]
Message-ID: <0b7c972c-f3e2-41ee-bd75-45bcae83a34a@roeck-us.net> (raw)
In-Reply-To: <20261008205310.30832-1-sanan.hasanou@gmail.com>

On Thu, Oct 08, 2026 at 04:52:45PM -0400, Sanan Hasanov wrote:
> From: Sanan Hasanov <sanan.hasanov@ucf.edu>
> 
> ccp_raw_event() is the HID ->raw_event() callback and takes
> wait_input_report_lock with a plain spin_lock(). This callback can run
> in very different contexts depending on the transport: from process
> context (e.g. uhid, via a write() to /dev/uhid) with softirqs and
> interrupts enabled, and from URB completion, which is softirq context
> for HCDs using HCD_BH and hard interrupt context for HCDs that do not
> (e.g. OHCI, UHCI).
> 
> Taking the lock from process context with softirqs enabled while the
> same lock is also taken from softirq context can deadlock if the
> softirq interrupts the lock holder on the same CPU. Lockdep reports:
> 
>   WARNING: inconsistent lock state
>   inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
>   ...
>    spin_lock include/linux/spinlock.h:347 [inline]
>    ccp_raw_event+0x51/0x110 drivers/hwmon/corsair-cpro.c:161
>    __hid_input_report+0x41c/0x580 drivers/hid/hid-core.c:2175
>    hid_irq_in+0x492/0x710 drivers/hid/usbhid/hid-core.c:287
>    __usb_hcd_giveback_urb+0x378/0x540 drivers/usb/core/hcd.c:1657
>    dummy_timer+0xa91/0x4cc0 drivers/usb/gadget/udc/dummy_hcd.c:2023
> 
> For the same reason, the spin_lock_bh() in send_usb_cmd() is not
> sufficient when ccp_raw_event() is called from hard interrupt context.
> 
> Use spin_lock_irqsave() in ccp_raw_event(), since it may be called with
> interrupts already disabled, and spin_lock_irq() in send_usb_cmd(),
> which always runs in process context.
> 
> Fixes: d02abd57e794 ("hwmon: (corsair-cpro) Protect ccp->wait_input_report with a spinlock")
> Reported-by: syzbot+0f98b0c0bdeaab2dc2fd@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=0f98b0c0bdeaab2dc2fd
> Cc: stable@vger.kernel.org
> Signed-off-by: Sanan Hasanov <sanan.hasanov@ucf.edu>

Applied.

Thanks,
Guenter

      reply	other threads:[~2026-10-18 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 20:52 Sanan Hasanov
2026-10-18 16:33 ` Guenter Roeck [this message]

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=0b7c972c-f3e2-41ee-bd75-45bcae83a34a@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@mariuszachmann.de \
    --cc=sanan.hasanou@gmail.com \
    --cc=sanan.hasanov@ucf.edu \
    --cc=savicaleksa83@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+0f98b0c0bdeaab2dc2fd@syzkaller.appspotmail.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®