diff options
| author | Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com> | 2026-10-01 13:19:15 +0300 |
|---|---|---|
| committer | Viresh Kumar <viresh.kumar@linaro.org> | 2026-10-05 09:25:54 +0530 |
| commit | 02c5d7bfa8724789f6620f7787532666edc891a1 (patch) | |
| tree | d03d4eb1ffa3c80059a1df8df8356757a1c4a0ab /tools/lib/python/kdoc/python_version.py | |
| parent | 801ade22c4fc078ea9b11e1f3fe3aae8b8bef886 (diff) | |
rust: cpufreq: reject NULL from cpufreq_cpu_get()
cpufreq_cpu_get() returns either a referenced policy or NULL.
PolicyCpu::from_cpu() passed its return value to from_err_ptr(), which
rejects ERR_PTR values but accepts NULL.
If the lookup fails, Policy::from_raw_mut() therefore constructs a mutable
reference from NULL. Dropping the resulting PolicyCpu then passes the
invalid pointer to cpufreq_cpu_put(), causing an oops in kobject_put().
Reject NULL with NonNull before constructing the Policy reference. Return
ENODEV instead.
A KUnit negative-control run reproduced the oops with the original
conversion. The same test passed with this change. The reproducer is
available on request.
Fixes: 6ebdd7c93177 ("rust: cpufreq: Extend abstractions for policy and driver ops")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Mehmet Koseoglu <mehmet.mkoseoglu@gmail.com>
Reviewed-by: Onur Özkan <work@onurozkan.dev>
Reviewed-by: spidermana <xuyiwen14@gmail.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
