hwmon: Fix potential UAF in pec_store
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.537.2.77.3In the Linux kernel, the following vulnerability has been resolved:
hwmon: Fix potential UAF in pec_store
Sashiko reports:
In pec_store(), a guard(mutex)(&hwdev->lock) is taken. If the chip write operation returns an error other than -EOPNOTSUPP, the code jumps to the put label, which calls put_device(hdev). If this drops the final reference, the device is freed. When the function then returns, the guard cleanup function runs and attempts to unlock the freed mutex.
Use scoped_guard() instead of guard() to avoid the problem.
From the CVE record · Linux
The Linux kernel's hwmon pec_store() can attempt to unlock a freed mutex. This can happen when a chip write returns an error other than -EOPNOTSUPP and put_device() drops the device's final reference. The input does not establish how an attacker could trigger this or whether authentication or user interaction is required.
Anyone running the Linux kernel should check whether their version includes the hwmon pec_store() fix; affected versions are not specified.