]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put()
authorXiongfeng Wang <wangxiongfeng2@huawei.com>
Mon, 14 Nov 2022 08:31:00 +0000 (16:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:42:20 +0000 (17:42 +0100)
commit170dec6ac6b18d0195c8305e8e6e8b83963d79d2
tree0aa6ec8837687f2503b07096319ce3c68b1c345e
parenteb0a67b0420822ab6825c899b0c2b7933f28a8f7
mmc: sdhci-pci: Fix possible memory leak caused by missing pci_dev_put()

commit 6d24cb917ce6cc5e29240691ad20dc7be409a65a upstream.

pci_get_device() will increase the reference count for the returned
pci_dev. We need to use pci_dev_put() to decrease the reference count
before amd_probe() returns. There is no problem for the 'smbus_dev ==
NULL' branch because pci_dev_put() can also handle the NULL input
parameter case.

Fixes: 251d6154d695 ("mmc: sdhci-pci: Build o2micro support in the same module")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20221114083100.149200-1-wangxiongfeng2@huawei.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/sdhci-pci-core.c