Takashi Iwai 317f62
From 27d2a2fd844ec7da70d19fabb482304fd1e0595b Mon Sep 17 00:00:00 2001
Takashi Iwai 317f62
From: Pietro Borrello <borrello@diag.uniroma1.it>
Takashi Iwai 317f62
Date: Sun, 12 Feb 2023 19:00:00 +0000
Takashi Iwai 317f62
Subject: [PATCH] HID: bigben_worker() remove unneeded check on report_field
Takashi Iwai 317f62
Git-commit: 27d2a2fd844ec7da70d19fabb482304fd1e0595b
Takashi Iwai 317f62
Patch-mainline: v6.3-rc1
Takashi Iwai 317f62
References: CVE-2023-25012 bsc#1207560
Takashi Iwai 317f62
Takashi Iwai 317f62
bigben_worker() checks report_field to be non-NULL.
Takashi Iwai 317f62
The check has been added in commit
Takashi Iwai 317f62
918aa1ef104d ("HID: bigbenff: prevent null pointer dereference")
Takashi Iwai 317f62
to prevent a NULL pointer crash.
Takashi Iwai 317f62
However, the true root cause was a missing check for output
Takashi Iwai 317f62
reports, patched in commit
Takashi Iwai 317f62
c7bf714f8755 ("HID: check empty report_list in bigben_probe()"),
Takashi Iwai 317f62
where the type-confused report list_entry was overlapping with
Takashi Iwai 317f62
a NULL pointer, which was then causing the crash.
Takashi Iwai 317f62
Takashi Iwai 317f62
Fixes: 918aa1ef104d ("HID: bigbenff: prevent null pointer dereference")
Takashi Iwai 317f62
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Takashi Iwai 317f62
Link: https://lore.kernel.org/r/20230125-hid-unregister-leds-v4-2-7860c5763c38@diag.uniroma1.it
Takashi Iwai 317f62
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Takashi Iwai 317f62
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai 317f62
Takashi Iwai 317f62
---
Takashi Iwai 317f62
 drivers/hid/hid-bigbenff.c | 2 +-
Takashi Iwai 317f62
 1 file changed, 1 insertion(+), 1 deletion(-)
Takashi Iwai 317f62
Takashi Iwai 317f62
diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c
Takashi Iwai 317f62
index ed3d2d7bc1dd..b98c5f31c184 100644
Takashi Iwai 317f62
--- a/drivers/hid/hid-bigbenff.c
Takashi Iwai 317f62
+++ b/drivers/hid/hid-bigbenff.c
Takashi Iwai 317f62
@@ -197,7 +197,7 @@ static void bigben_worker(struct work_struct *work)
Takashi Iwai 317f62
 	u32 len;
Takashi Iwai 317f62
 	unsigned long flags;
Takashi Iwai 317f62
 
Takashi Iwai 317f62
-	if (bigben->removed || !report_field)
Takashi Iwai 317f62
+	if (bigben->removed)
Takashi Iwai 317f62
 		return;
Takashi Iwai 317f62
 
Takashi Iwai 317f62
 	buf = hid_alloc_report_buf(bigben->report, GFP_KERNEL);
Takashi Iwai 317f62
-- 
Takashi Iwai 317f62
2.35.3
Takashi Iwai 317f62