Commit e1483ac
spi: bcm2835: Fix use-after-free on unbind
bcm2835_spi_remove() accesses the driver's private data after calling
spi_unregister_controller() even though that function releases the last
reference on the spi_controller and thereby frees the private data.
Fix by switching over to the new devm_spi_alloc_master() helper which
keeps the private data accessible until the driver has unbound.
Fixes: f804387 ("spi: add driver for BCM2835")
Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v3.10+: 123456789abc: spi: Introduce device-managed SPI controller allocation
Cc: <stable@vger.kernel.org> # v3.10+
Cc: Vladimir Oltean <olteanv@gmail.com>
Tested-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/ad66e0a0ad96feb848814842ecf5b6a4539ef35c.1605121038.git.lukas@wunner.de
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent 5e844cc commit e1483ac
1 file changed
Lines changed: 8 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1278 | 1278 | | |
1279 | 1279 | | |
1280 | 1280 | | |
1281 | | - | |
| 1281 | + | |
1282 | 1282 | | |
1283 | 1283 | | |
1284 | 1284 | | |
| |||
1299 | 1299 | | |
1300 | 1300 | | |
1301 | 1301 | | |
1302 | | - | |
1303 | | - | |
1304 | | - | |
1305 | | - | |
| 1302 | + | |
| 1303 | + | |
1306 | 1304 | | |
1307 | 1305 | | |
1308 | | - | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
1313 | 1309 | | |
1314 | 1310 | | |
1315 | | - | |
1316 | | - | |
1317 | | - | |
1318 | | - | |
| 1311 | + | |
| 1312 | + | |
1319 | 1313 | | |
1320 | 1314 | | |
1321 | 1315 | | |
| |||
1349 | 1343 | | |
1350 | 1344 | | |
1351 | 1345 | | |
1352 | | - | |
1353 | | - | |
1354 | 1346 | | |
1355 | 1347 | | |
1356 | 1348 | | |
| |||
0 commit comments