mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Yogesh Gaur <yogeshgaur.83@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Christopher Heiny <cheiny@synaptics.com>,
	Andrew Duggan <aduggan@synaptics.com>,
	 syzbot+09103639e39c989e3ed3@syzkaller.appspotmail.com
Subject: Re: [PATCH] Input: synaptics-rmi4 - fix NULL dereference in the PM callbacks
Date: Sun, 13 Sep 2026 17:51:34 -0700	[thread overview]
Message-ID: <aqdE6RLeWCo7Fngr@google.com> (raw)
In-Reply-To: <20260908165925.2030-1-yogeshgaur.83@gmail.com>

Hi Yogesh,

On Tue, Sep 08, 2026 at 10:29:25PM +0530, Yogesh Gaur wrote:
> rmi_driver_suspend() and rmi_driver_resume() are exported for the
> transport drivers; hid-rmi calls them straight from its ->suspend and
> ->resume. Both reach code that dereferences the driver data right away:
> 
> 	static int rmi_suspend_functions(struct rmi_device *rmi_dev)
> 	{
> 		struct rmi_driver_data *data = dev_get_drvdata(&rmi_dev->dev);
> 		...
> 		list_for_each_entry(entry, &data->function_list, node) {
> 
> That data is installed by rmi_driver_probe(), which binds only after the
> transport driver has already published rmi_dev via
> rmi_register_transport_device(). A runtime PM suspend of the underlying
> USB interface in that window dereferences NULL:
> 
> 	KASAN: null-ptr-deref in range [0x0000000000000078-0x000000000000007f]
> 	RIP: 0010:dev_get_drvdata include/linux/device.h:989 [inline]
> 	RIP: 0010:rmi_suspend_functions drivers/input/rmi4/rmi_driver.c:283 [inline]
> 	RIP: 0010:rmi_driver_suspend+0x30/0x180 drivers/input/rmi4/rmi_driver.c:994
> 	Call Trace:
> 	 <TASK>
> 	 rmi_suspend+0xa7/0xf0 drivers/hid/hid-rmi.c:448
> 	 hid_suspend+0x4a3/0x530 drivers/hid/usbhid/hid-core.c:1618
> 	 usb_suspend_interface drivers/usb/core/driver.c:1323 [inline]
> 	 usb_suspend_both+0x285/0x1040 drivers/usb/core/driver.c:1446
> 	 usb_runtime_suspend+0x58/0x110 drivers/usb/core/driver.c:2000
> 	 rpm_callback drivers/base/power/runtime.c:460 [inline]
> 	 rpm_suspend+0x8a0/0x17a0 drivers/base/power/runtime.c:698
> 	 pm_runtime_work+0x132/0x1b0 drivers/base/power/runtime.c
> 	 </TASK>
> 
> rmi_disable_irq() and rmi_enable_irq(), reached a few lines further on,
> look the driver data up the same way and then take
> &data->enabled_mutex, so they would fault too.
> 
> There is nothing to suspend or resume before the driver has bound, so
> return success early while the driver data is not there yet.
> 
> Fixes: 2b6a321da9a2 ("Input: synaptics-rmi4 - add support for Synaptics RMI4 devices")
> Reported-by: syzbot+09103639e39c989e3ed3@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=09103639e39c989e3ed3
> Signed-off-by: Yogesh Gaur <yogeshgaur.83@gmail.com>

Thank you for the patch, but I already have a fix for this:

https://patch.msgid.link/anQe8UiyUR4x0flD@google.com

Thanks.

-- 
Dmitry

      reply	other threads:[~2026-09-14  0:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 16:59 Yogesh Gaur
2026-09-14  0:51 ` Dmitry Torokhov [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=aqdE6RLeWCo7Fngr@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=aduggan@synaptics.com \
    --cc=cheiny@synaptics.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+09103639e39c989e3ed3@syzkaller.appspotmail.com \
    --cc=yogeshgaur.83@gmail.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®