summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Guobin <huangguobin4@huawei.com>2022-03-31 17:10:05 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-14 16:52:39 +0200
commitf4c836d90da1ece88905d62ce2ce39a962f25d1a (patch)
treee8df92ad043ebf262d6f9dbdd7c96246393db8ce
parent50c341f9a2adc4c32a8ad5a39eb99d9c4a419e0d (diff)
downloadlinux-stable-f4c836d90da1ece88905d62ce2ce39a962f25d1a.tar.gz
linux-stable-f4c836d90da1ece88905d62ce2ce39a962f25d1a.tar.bz2
linux-stable-f4c836d90da1ece88905d62ce2ce39a962f25d1a.zip
tty: Fix a possible resource leak in icom_probe
[ Upstream commit ee157a79e7c82b01ae4c25de0ac75899801f322c ] When pci_read_config_dword failed, call pci_release_regions() and pci_disable_device() to recycle the resource previously allocated. Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Huang Guobin <huangguobin4@huawei.com> Link: https://lore.kernel.org/r/20220331091005.3290753-1-huangguobin4@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/tty/serial/icom.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index c60a8d5e4020..a3e420669674 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -1515,7 +1515,7 @@ static int icom_probe(struct pci_dev *dev,
retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg);
if (retval) {
dev_err(&dev->dev, "PCI Config read FAILED\n");
- return retval;
+ goto probe_exit0;
}
pci_write_config_dword(dev, PCI_COMMAND,