Skip to content

Commit

Permalink
platform/x86: intel_skl_int3472: Correct null check
Browse files Browse the repository at this point in the history
The int3472-discrete driver can enter an error path after initialising
int3472->clock.ena_gpio, but before it has registered the clock. This will
cause a NULL pointer dereference, because clkdev_drop() is not null aware.
Instead of guarding the call to skl_int3472_unregister_clock() by checking
for .ena_gpio, check specifically for the presence of the clk_lookup, which
will guarantee clkdev_create() has already been called.

Bug: https://bugzilla.kernel.org/show_bug.cgi?id=214453
Fixes: 7540599 ("platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()")
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Link: https://lore.kernel.org/r/20211008224608.415949-1-djrscally@gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Daniel Scally authored and Hans de Goede committed Oct 11, 2021
1 parent 95384b3 commit 0b243c0
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ int skl_int3472_discrete_remove(struct platform_device *pdev)

gpiod_remove_lookup_table(&int3472->gpios);

if (int3472->clock.ena_gpio)
if (int3472->clock.cl)
skl_int3472_unregister_clock(int3472);

gpiod_put(int3472->clock.ena_gpio);
Expand Down

0 comments on commit 0b243c0

Please sign in to comment.