Commit 8bcfc9de authored by Jakub Kicinski's avatar Jakub Kicinski

Merge tag 'ieee802154-for-net-2023-10-10' of...

Merge tag 'ieee802154-for-net-2023-10-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan

Stefan Schmidt says:

====================
pull-request: ieee802154 for net 2023-10-10

Just one small fix this time around.

Dinghao Liu fixed a potential use-after-free in the ca8210 driver probe
function.

* tag 'ieee802154-for-net-2023-10-10' of git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan:
  ieee802154: ca8210: Fix a potential UAF in ca8210_probe
====================

Link: https://lore.kernel.org/r/20231010200943.82225-1-stefan@datenfreihafen.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents a950a592 f990874b
...@@ -2740,7 +2740,6 @@ static int ca8210_register_ext_clock(struct spi_device *spi) ...@@ -2740,7 +2740,6 @@ static int ca8210_register_ext_clock(struct spi_device *spi)
struct device_node *np = spi->dev.of_node; struct device_node *np = spi->dev.of_node;
struct ca8210_priv *priv = spi_get_drvdata(spi); struct ca8210_priv *priv = spi_get_drvdata(spi);
struct ca8210_platform_data *pdata = spi->dev.platform_data; struct ca8210_platform_data *pdata = spi->dev.platform_data;
int ret = 0;
if (!np) if (!np)
return -EFAULT; return -EFAULT;
...@@ -2757,18 +2756,8 @@ static int ca8210_register_ext_clock(struct spi_device *spi) ...@@ -2757,18 +2756,8 @@ static int ca8210_register_ext_clock(struct spi_device *spi)
dev_crit(&spi->dev, "Failed to register external clk\n"); dev_crit(&spi->dev, "Failed to register external clk\n");
return PTR_ERR(priv->clk); return PTR_ERR(priv->clk);
} }
ret = of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
if (ret) {
clk_unregister(priv->clk);
dev_crit(
&spi->dev,
"Failed to register external clock as clock provider\n"
);
} else {
dev_info(&spi->dev, "External clock set as clock provider\n");
}
return ret; return of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
} }
/** /**
...@@ -2780,8 +2769,8 @@ static void ca8210_unregister_ext_clock(struct spi_device *spi) ...@@ -2780,8 +2769,8 @@ static void ca8210_unregister_ext_clock(struct spi_device *spi)
{ {
struct ca8210_priv *priv = spi_get_drvdata(spi); struct ca8210_priv *priv = spi_get_drvdata(spi);
if (!priv->clk) if (IS_ERR_OR_NULL(priv->clk))
return return;
of_clk_del_provider(spi->dev.of_node); of_clk_del_provider(spi->dev.of_node);
clk_unregister(priv->clk); clk_unregister(priv->clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment