]> Gentwo Git Trees - linux/.git/commitdiff
platform/chrome: cros_ec_ishtp: Fix UAF after unbinding driver
authorTzung-Bi Shih <tzungbi@kernel.org>
Fri, 31 Oct 2025 03:39:00 +0000 (03:39 +0000)
committerTzung-Bi Shih <tzungbi@kernel.org>
Mon, 10 Nov 2025 06:29:54 +0000 (06:29 +0000)
After unbinding the driver, another kthread `cros_ec_console_log_work`
is still accessing the device, resulting an UAF and crash.

The driver doesn't unregister the EC device in .remove() which should
shutdown sub-devices synchronously.  Fix it.

Fixes: 26a14267aff2 ("platform/chrome: Add ChromeOS EC ISHTP driver")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20251031033900.3577394-1-tzungbi@kernel.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/cros_ec_ishtp.c

index 4e74e702c5a24d115e81e6e14942efc174c06c80..3766cef81fe82e902ce2d267b271c58c373519af 100644 (file)
@@ -667,6 +667,7 @@ static void cros_ec_ishtp_remove(struct ishtp_cl_device *cl_device)
 
        cancel_work_sync(&client_data->work_ishtp_reset);
        cancel_work_sync(&client_data->work_ec_evt);
+       cros_ec_unregister(client_data->ec_dev);
        cros_ish_deinit(cros_ish_cl);
        ishtp_put_device(cl_device);
 }