Skip to content

Commit ee3dbcf

Browse files
aff-tarrafaeljw
authored andcommitted
cpufreq: kryo: Fix possible error code dereference
In event of error returned by the nvmem_cell_read() non-pointer value may be dereferenced. Fix this with error handling. Additionally free the allocated speedbin buffer, as per the API. Fixes: 9ce36edd1a52 (cpufreq: Add Kryo CPU scaling driver) Signed-off-by: Ilia Lin <ilia.lin@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ce397d2 commit ee3dbcf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/cpufreq/qcom-cpufreq-kryo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
115115

116116
speedbin = nvmem_cell_read(speedbin_nvmem, &len);
117117
nvmem_cell_put(speedbin_nvmem);
118+
if (IS_ERR(speedbin))
119+
return PTR_ERR(speedbin);
118120

119121
switch (msm8996_version) {
120122
case MSM8996_V3:
@@ -127,6 +129,7 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev)
127129
BUG();
128130
break;
129131
}
132+
kfree(speedbin);
130133

131134
for_each_possible_cpu(cpu) {
132135
cpu_dev = get_cpu_device(cpu);

0 commit comments

Comments
 (0)