mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
dm: spi: Fix spi_free_slave() freed memory write
Remove setting slave->dev to NULL after the device_remove() call. The slave pointer points to dev->parent_priv, which has already been freed by device_free(), called from device_remove() in the preceding line. Writing to slave->dev may cause corruption of the dlmalloc free chunk forward pointer of the previously freed chunk. Signed-off-by: Niel Fourie <lusus@denx.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
a5624c6b4c
commit
fc314300dd
1 changed files with 0 additions and 1 deletions
|
@ -435,7 +435,6 @@ struct spi_slave *spi_setup_slave(unsigned int busnum, unsigned int cs,
|
|||
void spi_free_slave(struct spi_slave *slave)
|
||||
{
|
||||
device_remove(slave->dev, DM_REMOVE_NORMAL);
|
||||
slave->dev = NULL;
|
||||
}
|
||||
|
||||
int spi_slave_of_to_plat(struct udevice *dev, struct dm_spi_slave_plat *plat)
|
||||
|
|
Loading…
Add table
Reference in a new issue