Skip to content

Commit 183def8

Browse files
Minjong Kimgregkh
authored andcommitted
HID: hid-ntrig: fix unable to handle page fault in ntrig_report_version()
commit 185c926 upstream. in ntrig_report_version(), hdev parameter passed from hid_probe(). sending descriptor to /dev/uhid can make hdev->dev.parent->parent to null if hdev->dev.parent->parent is null, usb_dev has invalid address(0xffffffffffffff58) that hid_to_usb_dev(hdev) returned when usb_rcvctrlpipe() use usb_dev,it trigger page fault error for address(0xffffffffffffff58) add null check logic to ntrig_report_version() before calling hid_to_usb_dev() Signed-off-by: Minjong Kim <minbell.kim@samsung.com> Link: https://patch.msgid.link/20250813-hid-ntrig-page-fault-fix-v2-1-f98581f35106@samsung.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 317daff commit 183def8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/hid/hid-ntrig.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static void ntrig_report_version(struct hid_device *hdev)
144144
struct usb_device *usb_dev = hid_to_usb_dev(hdev);
145145
unsigned char *data = kmalloc(8, GFP_KERNEL);
146146

147+
if (!hid_is_usb(hdev))
148+
return;
149+
147150
if (!data)
148151
goto err_free;
149152

0 commit comments

Comments
 (0)