VYPR
Unrated severityNVD Advisory· Published May 28, 2026

CVE-2026-46226

CVE-2026-46226

Description

In the Linux kernel, the following vulnerability has been resolved:

spi: fsl: fix controller deregistration

Make sure to deregister the controller before releasing underlying resources like DMA during driver unbind.

Affected products

2

Patches

10
5750743a39c9

spi: fsl: fix controller deregistration

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJohan HovoldApr 10, 2026Fixed in 7.0.9via kernel-cna
1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index bf3fc3ce0cc2f7..1252c41c206f87 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
ca3195c7b883

spi: fsl: fix controller deregistration

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJohan HovoldApr 10, 2026Fixed in 6.18.32via kernel-cna
1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 481a7b28aacd3d..a516abbb6f67a4 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
9b7abfed4c37

spi: fsl: fix controller deregistration

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJohan HovoldApr 10, 2026Fixed in 7.1-rc1via kernel-cna
1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index bf3fc3ce0cc2f7..1252c41c206f87 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
562d954a1449

spi: fsl: fix controller deregistration

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJohan HovoldApr 10, 2026Fixed in 6.6.140via kernel-cna
1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 750e2cd2594dcf..8c4db353779034 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -615,7 +615,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -706,7 +706,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -752,7 +758,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
e88830822237

spi: fsl: fix controller deregistration

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.gitJohan HovoldApr 10, 2026Fixed in 6.12.90via kernel-cna
1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 5a44627be9300a..358c2a7e4cad3a 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
ca3195c7b883

spi: fsl: fix controller deregistration

1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 481a7b28aacd3d..a516abbb6f67a4 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
5750743a39c9

spi: fsl: fix controller deregistration

1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index bf3fc3ce0cc2f7..1252c41c206f87 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
e88830822237

spi: fsl: fix controller deregistration

1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 5a44627be9300a..358c2a7e4cad3a 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
562d954a1449

spi: fsl: fix controller deregistration

1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index 750e2cd2594dcf..8c4db353779034 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -615,7 +615,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -706,7 +706,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -752,7 +758,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    
9b7abfed4c37

spi: fsl: fix controller deregistration

1 file changed · +13 2
  • drivers/spi/spi-fsl-spi.c+13 2 modified
    diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
    index bf3fc3ce0cc2f7..1252c41c206f87 100644
    --- a/drivers/spi/spi-fsl-spi.c
    +++ b/drivers/spi/spi-fsl-spi.c
    @@ -614,7 +614,7 @@ static struct spi_controller *fsl_spi_probe(struct device *dev,
     
     	mpc8xxx_spi_write_reg(&reg_base->mode, regval);
     
    -	ret = devm_spi_register_controller(dev, host);
    +	ret = spi_register_controller(host);
     	if (ret < 0)
     		goto err_probe;
     
    @@ -705,7 +705,13 @@ static void of_fsl_spi_remove(struct platform_device *ofdev)
     	struct spi_controller *host = platform_get_drvdata(ofdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     static struct platform_driver of_fsl_spi_driver = {
    @@ -751,7 +757,13 @@ static void plat_mpc8xxx_spi_remove(struct platform_device *pdev)
     	struct spi_controller *host = platform_get_drvdata(pdev);
     	struct mpc8xxx_spi *mpc8xxx_spi = spi_controller_get_devdata(host);
     
    +	spi_controller_get(host);
    +
    +	spi_unregister_controller(host);
    +
     	fsl_spi_cpm_free(mpc8xxx_spi);
    +
    +	spi_controller_put(host);
     }
     
     MODULE_ALIAS("platform:mpc8xxx_spi");
    -- 
    cgit 1.3-korg
    
    
    

Vulnerability mechanics

Root cause

"Use of devm_spi_register_controller() causes the SPI controller to be deregistered after driver resources (e.g. DMA) are already freed during unbind, creating a use-after-free ordering bug."

Attack vector

An attacker with the ability to trigger driver unbind (e.g. via device removal or module unloading) on a system using the fsl-spi driver can exploit the incorrect teardown ordering. The devm-managed deregistration runs after the driver's remove callback has already freed DMA and other resources via fsl_spi_cpm_free(), leading to a use-after-free condition when the SPI core accesses the freed controller state [patch_id=2897613]. No special network path or payload is required; the precondition is local access to unbind the driver.

Affected code

The vulnerability is in drivers/spi/spi-fsl-spi.c in the probe function fsl_spi_probe() and the two remove callbacks of_fsl_spi_remove() and plat_mpc8xxx_spi_remove() [patch_id=2897613]. The probe used devm_spi_register_controller() which deferred deregistration to devres cleanup, and the remove callbacks freed DMA resources via fsl_spi_cpm_free() without first unregistering the controller.

What the fix does

The patch replaces devm_spi_register_controller() with spi_register_controller() in the probe path, removing the automatic devres-based deregistration. In both remove callbacks (of_fsl_spi_remove and plat_mpc8xxx_spi_remove), it adds explicit spi_unregister_controller() before fsl_spi_cpm_free(), and wraps the sequence with spi_controller_get()/spi_controller_put() to prevent the controller from being freed during unregistration [patch_id=2897613]. This ensures the controller is fully deregistered while its resources are still valid, before DMA and other backing resources are released.

Preconditions

  • inputAttacker must be able to trigger driver unbind (e.g. device removal, module unloading) on a system using the fsl-spi driver

Generated on May 28, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.