* [PATCH] tc35815: fix iomap leak
@ 2010-07-10 10:03 Kulikov Vasiliy
2010-07-13 3:33 ` David Miller
2010-07-13 13:14 ` Atsushi Nemoto
0 siblings, 2 replies; 4+ messages in thread
From: Kulikov Vasiliy @ 2010-07-10 10:03 UTC (permalink / raw)
To: kernel-janitors
Cc: David S. Miller, Atsushi Nemoto, Jiri Pirko, Eric Dumazet,
Alexey Dobriyan, netdev
If tc35815_init_one() fails we must unmap mapped regions.
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
drivers/net/tc35815.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index be08b75..99afa5c 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -854,7 +854,7 @@ static int __devinit tc35815_init_one(struct pci_dev *pdev,
rc = register_netdev(dev);
if (rc)
- goto err_out;
+ goto err_out_iounmap;
memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
printk(KERN_INFO "%s: %s at 0x%lx, %pM, IRQ %d\n",
@@ -872,6 +872,8 @@ static int __devinit tc35815_init_one(struct pci_dev *pdev,
err_out_unregister:
unregister_netdev(dev);
+err_out_iounmap:
+ pcim_iounmap_regions(pdev, 1 << 1);
err_out:
free_netdev(dev);
return rc;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] tc35815: fix iomap leak
2010-07-10 10:03 [PATCH] tc35815: fix iomap leak Kulikov Vasiliy
@ 2010-07-13 3:33 ` David Miller
2010-07-13 13:14 ` Atsushi Nemoto
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2010-07-13 3:33 UTC (permalink / raw)
To: segooon; +Cc: kernel-janitors, anemo, jpirko, eric.dumazet, adobriyan, netdev
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Sat, 10 Jul 2010 14:03:18 +0400
> If tc35815_init_one() fails we must unmap mapped regions.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tc35815: fix iomap leak
2010-07-10 10:03 [PATCH] tc35815: fix iomap leak Kulikov Vasiliy
2010-07-13 3:33 ` David Miller
@ 2010-07-13 13:14 ` Atsushi Nemoto
2010-07-13 21:24 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2010-07-13 13:14 UTC (permalink / raw)
To: segooon; +Cc: kernel-janitors, davem, jpirko, eric.dumazet, adobriyan, netdev
On Sat, 10 Jul 2010 14:03:18 +0400, Kulikov Vasiliy <segooon@gmail.com> wrote:
> If tc35815_init_one() fails we must unmap mapped regions.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
> drivers/net/tc35815.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
No, pcim_xxx APIs are _managed_ interfaces. These resources are
released automatically. Actually currently nobody in kernel call
pcim_iounmap_regions() now.
And _if_ there is any reason to call pcim_iounmap_regions()
explicitly, it should be called in tc35815_remove_one() too.
So, NAK.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tc35815: fix iomap leak
2010-07-13 13:14 ` Atsushi Nemoto
@ 2010-07-13 21:24 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2010-07-13 21:24 UTC (permalink / raw)
To: anemo; +Cc: segooon, kernel-janitors, jpirko, eric.dumazet, adobriyan, netdev
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 13 Jul 2010 22:14:28 +0900 (JST)
> On Sat, 10 Jul 2010 14:03:18 +0400, Kulikov Vasiliy <segooon@gmail.com> wrote:
>> If tc35815_init_one() fails we must unmap mapped regions.
>>
>> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
>> ---
>> drivers/net/tc35815.c | 4 +++-
>> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> No, pcim_xxx APIs are _managed_ interfaces. These resources are
> released automatically. Actually currently nobody in kernel call
> pcim_iounmap_regions() now.
>
> And _if_ there is any reason to call pcim_iounmap_regions()
> explicitly, it should be called in tc35815_remove_one() too.
>
> So, NAK.
I've reverted this patch, thanks.
Can someone go over the other similar patches I applied already to
net-next-2.6 to see if they have the same problem? If so I'll revert
them too.
BTW, I think from one perspective the pcim_*() APIs make it harder to
audit a driver because resource management is magic and implicit
rather than explicit. It adds an extra step to the audit, and I
don't see any effort being made to do a mass conversion of all
drivers to pcim_xxx which would be the only way in my mind for this
to truly make it easier to audit drivers for resource leak problems.
If both driver types (pcim_xxx and non-pcim_xxx) exist, it just means
more work for auditors as they have oen more thing to check for
instead of less things.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-07-13 21:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10 10:03 [PATCH] tc35815: fix iomap leak Kulikov Vasiliy
2010-07-13 3:33 ` David Miller
2010-07-13 13:14 ` Atsushi Nemoto
2010-07-13 21:24 ` 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).