summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorKeita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>2020-09-09 07:18:51 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-29 09:58:06 +0100
commit0e3f41b6bec01192ea87cfc7249b98ad034ad398 (patch)
treef9b95151119178047ea589c24f756d330c6563e3 /drivers/misc
parent3a8d86d8da1b992db9af553be7c6d62249b5df5e (diff)
downloadlinux-stable-0e3f41b6bec01192ea87cfc7249b98ad034ad398.tar.gz
linux-stable-0e3f41b6bec01192ea87cfc7249b98ad034ad398.tar.bz2
linux-stable-0e3f41b6bec01192ea87cfc7249b98ad034ad398.zip
misc: rtsx: Fix memory leak in rtsx_pci_probe
[ Upstream commit bc28369c6189009b66d9619dd9f09bd8c684bb98 ] When mfd_add_devices() fail, pcr->slots should also be freed. However, the current implementation does not free the member, leading to a memory leak. Fix this by adding a new goto label that frees pcr->slots. Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp> Link: https://lore.kernel.org/r/20200909071853.4053-1-keitasuzuki.park@sslab.ics.keio.ac.jp Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/cardreader/rtsx_pcr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index 1958833b3b74..4fd57052ddd3 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1534,12 +1534,14 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
ret = mfd_add_devices(&pcidev->dev, pcr->id, rtsx_pcr_cells,
ARRAY_SIZE(rtsx_pcr_cells), NULL, 0, NULL);
if (ret < 0)
- goto disable_irq;
+ goto free_slots;
schedule_delayed_work(&pcr->idle_work, msecs_to_jiffies(200));
return 0;
+free_slots:
+ kfree(pcr->slots);
disable_irq:
free_irq(pcr->irq, (void *)pcr);
disable_msi: