mbox series

[0/9] mmc: fix return value check of mmc_add_host()

Message ID 20221101063023.1664968-1-yangyingliang@huawei.com (mailing list archive)
Headers show
Series mmc: fix return value check of mmc_add_host() | expand

Message

Yang Yingliang Nov. 1, 2022, 6:30 a.m. UTC
mmc_add_host() may return error, but it was ignored in some drivers, if we
ignore it, the memory that allocated in mmc_alloc_host() will be leaked and
it will lead a kernel crash because of deleting not added device in the remove
path.

So fix this by checking the return value and calling mmc_free_host() in error
path.

Yang Yingliang (9):
  mmc: alcor: fix return value check of mmc_add_host()
  mmc: moxart: fix return value check of mmc_add_host()
  mmc: mxcmmc: fix return value check of mmc_add_host()
  mmc: pxamci: fix return value check of mmc_add_host()
  mmc: rtsx_pci: fix return value check of mmc_add_host()
  mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
  mmc: toshsd: fix return value check of mmc_add_host()
  mmc: vub300: fix return value check of mmc_add_host()
  mmc: wmt-sdmmc: fix return value check of mmc_add_host()

 drivers/mmc/host/alcor.c          |  5 ++++-
 drivers/mmc/host/moxart-mmc.c     |  4 +++-
 drivers/mmc/host/mxcmmc.c         |  4 +++-
 drivers/mmc/host/pxamci.c         |  7 ++++++-
 drivers/mmc/host/rtsx_pci_sdmmc.c |  9 ++++++++-
 drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++++++++-
 drivers/mmc/host/toshsd.c         |  6 +++++-
 drivers/mmc/host/vub300.c         | 11 ++++++++---
 drivers/mmc/host/wmt-sdmmc.c      |  6 +++++-
 9 files changed, 52 insertions(+), 11 deletions(-)

Comments

Ulf Hansson Nov. 8, 2022, 4:05 p.m. UTC | #1
On Tue, 1 Nov 2022 at 07:32, Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> mmc_add_host() may return error, but it was ignored in some drivers, if we
> ignore it, the memory that allocated in mmc_alloc_host() will be leaked and
> it will lead a kernel crash because of deleting not added device in the remove
> path.
>
> So fix this by checking the return value and calling mmc_free_host() in error
> path.
>
> Yang Yingliang (9):
>   mmc: alcor: fix return value check of mmc_add_host()
>   mmc: moxart: fix return value check of mmc_add_host()
>   mmc: mxcmmc: fix return value check of mmc_add_host()
>   mmc: pxamci: fix return value check of mmc_add_host()
>   mmc: rtsx_pci: fix return value check of mmc_add_host()
>   mmc: rtsx_usb_sdmmc: fix return value check of mmc_add_host()
>   mmc: toshsd: fix return value check of mmc_add_host()
>   mmc: vub300: fix return value check of mmc_add_host()
>   mmc: wmt-sdmmc: fix return value check of mmc_add_host()
>
>  drivers/mmc/host/alcor.c          |  5 ++++-
>  drivers/mmc/host/moxart-mmc.c     |  4 +++-
>  drivers/mmc/host/mxcmmc.c         |  4 +++-
>  drivers/mmc/host/pxamci.c         |  7 ++++++-
>  drivers/mmc/host/rtsx_pci_sdmmc.c |  9 ++++++++-
>  drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++++++++-
>  drivers/mmc/host/toshsd.c         |  6 +++++-
>  drivers/mmc/host/vub300.c         | 11 ++++++++---
>  drivers/mmc/host/wmt-sdmmc.c      |  6 +++++-
>  9 files changed, 52 insertions(+), 11 deletions(-)
>

Applied for next, thanks!

Kind regards
Uffe