Commit e13ee6c
spi: bcm2835aux: Fix use-after-free on unbind
bcm2835aux_spi_remove() accesses the driver's private data after calling
spi_unregister_master() even though that function releases the last
reference on the spi_master 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: b9dd3f6 ("spi: bcm2835aux: Fix controller unregister order")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v4.4+: 123456789abc: spi: Introduce device-managed SPI controller allocation
Cc: <stable@vger.kernel.org> # v4.4+: b9dd3f6: spi: bcm2835aux: Fix controller unregister order
Cc: <stable@vger.kernel.org> # v4.4+
Link: https://lore.kernel.org/r/b290b06357d0c0bdee9cecc539b840a90630f101.1605121038.git.lukas@wunner.de
Signed-off-by: Mark Brown <broonie@kernel.org>1 parent e1483ac commit e13ee6c
1 file changed
Lines changed: 7 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| |||
524 | 524 | | |
525 | 525 | | |
526 | 526 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 527 | + | |
| 528 | + | |
531 | 529 | | |
532 | 530 | | |
533 | 531 | | |
534 | | - | |
535 | 532 | | |
536 | | - | |
| 533 | + | |
537 | 534 | | |
538 | 535 | | |
539 | 536 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
| 537 | + | |
| 538 | + | |
544 | 539 | | |
545 | 540 | | |
546 | 541 | | |
547 | 542 | | |
548 | 543 | | |
549 | | - | |
| 544 | + | |
550 | 545 | | |
551 | 546 | | |
552 | 547 | | |
| |||
581 | 576 | | |
582 | 577 | | |
583 | 578 | | |
584 | | - | |
585 | | - | |
586 | 579 | | |
587 | 580 | | |
588 | 581 | | |
| |||
0 commit comments