* [PATCH] xfrm: fix a possible leak of dev reference count.
@ 2010-08-08 13:34 Zhang JieJing
2010-08-09 3:17 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Zhang JieJing @ 2010-08-08 13:34 UTC (permalink / raw)
To: netdev; +Cc: Dan Carpenter, Zhang Jiejing
call dev_put(dev) on error path.
Signed-off-by: JieJing.Zhang <kzjeef@gmail.com>
---
net/ipv4/xfrm4_policy.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index 1705476..d2a4873 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -81,8 +81,10 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst,
struct net_device *dev,
dev_hold(dev);
xdst->u.rt.idev = in_dev_get(dev);
- if (!xdst->u.rt.idev)
+ if (!xdst->u.rt.idev) {
+ dev_put(dev);
return -ENODEV;
+ }
xdst->u.rt.peer = rt->peer;
if (rt->peer)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfrm: fix a possible leak of dev reference count.
2010-08-08 13:34 [PATCH] xfrm: fix a possible leak of dev reference count Zhang JieJing
@ 2010-08-09 3:17 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-08-09 3:17 UTC (permalink / raw)
To: kzjeef; +Cc: netdev, error27
From: Zhang JieJing <kzjeef@gmail.com>
Date: Sun, 8 Aug 2010 21:34:12 +0800
> call dev_put(dev) on error path.
>
> Signed-off-by: JieJing.Zhang <kzjeef@gmail.com>
There is no leak, the caller will dst_free() the dst and at
such time the device at dst->dev will be released.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-09 3:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-08 13:34 [PATCH] xfrm: fix a possible leak of dev reference count Zhang JieJing
2010-08-09 3:17 ` 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).