summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>2026-07-20 17:08:32 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-09-07 17:18:22 +0200
commitfcc6c3b11d73459e0d55b27c98cc56d59fef4d82 (patch)
treeee4aad34a977a79059fd014a2b70ebc517305a77
parent2b154e96fcb3f01fd42765c64e0a56820fbc16eb (diff)
downloadlinux-stable-fcc6c3b11d73459e0d55b27c98cc56d59fef4d82.tar.gz
linux-stable-fcc6c3b11d73459e0d55b27c98cc56d59fef4d82.zip
mfd: sm501: Fix potential memory leaks during remove
commit 83feedd9d83c0c5199f98c72df0a6196b4aefb4d upstream. The memory allocated for struct sm501_devdata in sm501_pci_probe() and sm501_plat_probe() is not freed by the corresponding remove functions sm501_pci_remove() and sm501_plat_remove(). Fix that by adding a call to kfree(). Fixes: b6d6454fdb66 ("[PATCH] mfd: SM501 core driver") Cc: stable@vger.kernel.org Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Link: https://patch.msgid.link/20260720113836.73133-1-nihaal@cse.iitm.ac.in Signed-off-by: Lee Jones <lee@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mfd/sm501.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 06e796883189..5752099683eb 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1667,6 +1667,7 @@ static void sm501_pci_remove(struct pci_dev *dev)
release_mem_region(sm->io_res->start, 0x100);
pci_disable_device(dev);
+ kfree(sm);
}
static void sm501_plat_remove(struct platform_device *dev)
@@ -1677,6 +1678,7 @@ static void sm501_plat_remove(struct platform_device *dev)
iounmap(sm->regs);
release_mem_region(sm->io_res->start, 0x100);
+ kfree(sm);
}
static const struct pci_device_id sm501_pci_tbl[] = {