Skip to content

Commit

Permalink
tty: Fix a possible resource leak in icom_probe
Browse files Browse the repository at this point in the history
[ Upstream commit ee157a7 ]

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>
  • Loading branch information
Huang Guobin authored and gregkh committed Jun 14, 2022
1 parent d68d5e6 commit cb7147a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/icom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,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,
Expand Down

0 comments on commit cb7147a

Please sign in to comment.