Re: [PATCH] platform/x86: intel_skl_int3472: Correct null check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 10/9/21 12:46 AM, Daniel Scally wrote:
> 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: 7540599a5ef1 ("platform/x86: intel_skl_int3472: Provide skl_int3472_unregister_clock()")
> Signed-off-by: Daniel Scally <djrscally@xxxxxxxxx>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

I will also include this in my upcoming pdx86-fixes pull-req for 5.15 .

Regards,

Hans


> ---
>  drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> index 9fe0a2527e1c..e59d79c7e82f 100644
> --- a/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> +++ b/drivers/platform/x86/intel/int3472/intel_skl_int3472_discrete.c
> @@ -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);
> 




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux