]> Git Repo - linux.git/commitdiff
soundwire: intel_init: test link->cdns
authorBard Liao <[email protected]>
Tue, 6 Apr 2021 01:01:01 +0000 (09:01 +0800)
committerVinod Koul <[email protected]>
Tue, 6 Apr 2021 04:56:44 +0000 (10:26 +0530)
intel_link_probe() could return error and dev_get_drvdata() will return
null in such case. So we have to test link->cdns after
link->cdns = dev_get_drvdata(&ldev->auxdev.dev);
Otherwise, we will meet the "kernel NULL pointer dereference" error.

Signed-off-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Rander Wang <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
drivers/soundwire/intel_init.c

index 05b726cdfebc5804a7a2608e45341f8dbbf54511..30ce95ec2d703bec11b05b218741a63e7d9f623f 100644 (file)
@@ -178,6 +178,15 @@ static struct sdw_intel_ctx
                link->pdev = pdev;
                link->cdns = platform_get_drvdata(pdev);
 
+               if (!link->cdns) {
+                       dev_err(&adev->dev, "failed to get link->cdns\n");
+                       /*
+                        * 1 will be subtracted from i in the err label, but we need to call
+                        * intel_link_dev_unregister for this ldev, so plus 1 now
+                        */
+                       i++;
+                       goto err;
+               }
                list_add_tail(&link->list, &ctx->link_list);
                bus = &link->cdns->bus;
                /* Calculate number of slaves */
This page took 0.065822 seconds and 4 git commands to generate.