Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9RBZI CVE: CVE-2021-47469
--------------------------------
Move struct mutex add_lock from struct spi_controller to struct device in case of kabi breakage in struct spi_controller.
Fixes: 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on SPI buses") Signed-off-by: Zeng Heng zengheng4@huawei.com --- include/linux/device.h | 8 ++++++++ include/linux/spi/spi.h | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/linux/device.h b/include/linux/device.h index 44a3dd381f55..534fedce1fbc 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1078,7 +1078,15 @@ struct device { #else KABI_RESERVE(1) #endif +#ifdef CONFIG_SPI_MASTER + /* + * Reserved for struct spi_controller. + * Used to avoid adding the same CS twice. + */ + KABI_USE(2, struct mutex *add_lock) +#else KABI_RESERVE(2) +#endif KABI_RESERVE(3) KABI_RESERVE(4) KABI_RESERVE(5) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 449e961834e4..a64235e05321 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -463,9 +463,6 @@ struct spi_controller { /* I/O mutex */ struct mutex io_mutex;
- /* Used to avoid adding the same CS twice */ - struct mutex add_lock; - /* lock and mutex for SPI bus locking */ spinlock_t bus_lock_spinlock; struct mutex bus_lock_mutex;