linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ca8210: Fix crash by zero initializing data
@ 2022-11-21  0:22 Hauke Mehrtens
  2022-11-29 14:00 ` Stefan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Hauke Mehrtens @ 2022-11-21  0:22 UTC (permalink / raw)
  To: alex.aring, stefan; +Cc: linux-wpan, harrymorris12, Hauke Mehrtens

The struct cas_control embeds multiple generic SPI structures and we
have to make sure these structures are initialized to default values.
This driver does not set all attributes. When using kmalloc before some
attributes were not initialized and contained random data which caused
random crashes at bootup.

Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/ieee802154/ca8210.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 450b16ad40a4..e1a569b99e4a 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -885,7 +885,7 @@ static int ca8210_spi_transfer(
 
 	dev_dbg(&spi->dev, "%s called\n", __func__);
 
-	cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC);
+	cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC);
 	if (!cas_ctl)
 		return -ENOMEM;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ca8210: Fix crash by zero initializing data
  2022-11-21  0:22 [PATCH] ca8210: Fix crash by zero initializing data Hauke Mehrtens
@ 2022-11-29 14:00 ` Stefan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Schmidt @ 2022-11-29 14:00 UTC (permalink / raw)
  To: Hauke Mehrtens, alex.aring; +Cc: linux-wpan, harrymorris12

Hello.

On 21.11.22 01:22, Hauke Mehrtens wrote:
> The struct cas_control embeds multiple generic SPI structures and we
> have to make sure these structures are initialized to default values.
> This driver does not set all attributes. When using kmalloc before some
> attributes were not initialized and contained random data which caused
> random crashes at bootup.
> 
> Fixes: ded845a781a5 ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   drivers/net/ieee802154/ca8210.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index 450b16ad40a4..e1a569b99e4a 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -885,7 +885,7 @@ static int ca8210_spi_transfer(
>   
>   	dev_dbg(&spi->dev, "%s called\n", __func__);
>   
> -	cas_ctl = kmalloc(sizeof(*cas_ctl), GFP_ATOMIC);
> +	cas_ctl = kzalloc(sizeof(*cas_ctl), GFP_ATOMIC);
>   	if (!cas_ctl)
>   		return -ENOMEM;
>   

This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-29 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21  0:22 [PATCH] ca8210: Fix crash by zero initializing data Hauke Mehrtens
2022-11-29 14:00 ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).