Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:

Pre-existing issues:
- [High] The asus-armoury driver incorrectly uses device_destroy() with 
MKDEV(0,0), which can destroy other drivers' firmware attribute devices.
--

--- Patch [2]: [PATCH v10 2/4] firmware: Move firmware attributes class helper 
---
commit 054683b4de0166df7f1b8f201cf00b84efd05b62
Author: Sean Rhodes <[email protected]>

firmware: Move firmware attributes class helper

Move the firmware attributes class helper from drivers/platform/x86 to
drivers/firmware and expose its class declaration through a public Linux
header. The helper is not x86-specific, allowing coreboot firmware drivers
to use the standard ABI without living under platform/x86.

[ ... ]

> diff --git a/drivers/platform/x86/asus-armoury.c 
> b/drivers/platform/x86/asus-armoury.c
> index f3d8c5a857621..e6af93608ec50 100644
> --- a/drivers/platform/x86/asus-armoury.c
> +++ b/drivers/platform/x86/asus-armoury.c
> @@ -20,7 +20,7 @@
>  #include <linux/dmi.h>
>  #include <linux/err.h>
>  #include <linux/errno.h>
> -#include "firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>

[Severity: High]
This is a pre-existing issue, but I noticed a potential problem with how
this class is used in this driver.

In asus_fw_attr_add() (on the error path) and asus_fw_exit(), the driver calls:

    device_destroy(&firmware_attributes_class, MKDEV(0, 0));

device_destroy() uses class_find_device_by_devt() to find the first device
matching the devt (which is MKDEV(0,0)).

Multiple drivers in this class (like dell-wmi-sysman or think-lmi) create
devices with devt=0.

Will this indiscriminately destroy another driver's device instead of the
one belonging to asus-armoury?

If another firmware attributes driver is active, could this leave the victim
driver with a dangling device pointer, leading to a crash when it unloads and
calls device_unregister(), while leaking the actual asus-armoury device?

>  #include <linux/fs.h>
>  #include <linux/kernel.h>
>  #include <linux/kmod.h>

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to