Skip to content

Commit

Permalink
ca8210: Fix crash by zero initializing data
Browse files Browse the repository at this point in the history
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: ded845a ("ieee802154: Add CA8210 IEEE 802.15.4 device driver")
Signed-off-by: Hauke Mehrtens <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stefan Schmidt <[email protected]>
  • Loading branch information
hauke authored and Stefan-Schmidt committed Nov 29, 2022
1 parent 4d002d6 commit 1e24c54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ieee802154/ca8210.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 1e24c54

Please sign in to comment.