Commit 350d0076 authored by Atsushi Nemoto's avatar Atsushi Nemoto Committed by Linus Torvalds

spi: fix double-free on spi_unregister_master

After 49dce689, device_for_each_child
iteration hits the master device itself.  Do not call spi_unregister_device()
for the master device.
Signed-off-by: default avatarAtsushi Nemoto <>
Acked-by: default avatarDavid Brownell <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent cbff2fbf
......@@ -457,10 +457,11 @@ done:
static int __unregister(struct device *dev, void *unused)
static int __unregister(struct device *dev, void *master_dev)
/* note: before about 2.6.14-rc1 this would corrupt memory: */
if (dev != master_dev)
return 0;
......@@ -478,7 +479,8 @@ void spi_unregister_master(struct spi_master *master)
int dummy;
dummy = device_for_each_child(master->dev.parent, NULL, __unregister);
dummy = device_for_each_child(master->dev.parent, &master->dev,
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