netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] wan: pc300too: abort path on failure
@ 2017-04-23  9:38 Pan Bian
  2017-04-24 19:51 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2017-04-23  9:38 UTC (permalink / raw)
  To: Krzysztof Halasa; +Cc: netdev, linux-kernel, Pan Bian

From: Pan Bian <bianpan2016@163.com>

In function pc300_pci_init_one(), on the ioremap error path, function
pc300_pci_remove_one() is called to free the allocated memory. However,
the path is not terminated, and the freed memory will be used later,
resulting in use-after-free bugs. This path fixes the bug.

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 drivers/net/wan/pc300too.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c
index e1dd1ec..b9b934b 100644
--- a/drivers/net/wan/pc300too.c
+++ b/drivers/net/wan/pc300too.c
@@ -346,6 +346,7 @@ static int pc300_pci_init_one(struct pci_dev *pdev,
 	    card->rambase == NULL) {
 		pr_err("ioremap() failed\n");
 		pc300_pci_remove_one(pdev);
+		return -ENOMEM;
 	}
 
 	/* PLX PCI 9050 workaround for local configuration register read bug */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] wan: pc300too: abort path on failure
  2017-04-23  9:38 [PATCH 1/1] wan: pc300too: abort path on failure Pan Bian
@ 2017-04-24 19:51 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-24 19:51 UTC (permalink / raw)
  To: bianpan201602; +Cc: khc, netdev, linux-kernel, bianpan2016

From: Pan Bian <bianpan201602@163.com>
Date: Sun, 23 Apr 2017 17:38:35 +0800

> From: Pan Bian <bianpan2016@163.com>
> 
> In function pc300_pci_init_one(), on the ioremap error path, function
> pc300_pci_remove_one() is called to free the allocated memory. However,
> the path is not terminated, and the freed memory will be used later,
> resulting in use-after-free bugs. This path fixes the bug.
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-24 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-23  9:38 [PATCH 1/1] wan: pc300too: abort path on failure Pan Bian
2017-04-24 19:51 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).