netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] gtp: put back reference to netns when not required anymore
@ 2016-05-12 15:16 Pablo Neira Ayuso
  2016-05-12 18:37 ` Cong Wang
  2016-05-12 19:29 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2016-05-12 15:16 UTC (permalink / raw)
  To: netdev; +Cc: davem, xiyou.wangcong

This patch fixes a netns leak.

Fixes: 93edb8c7f94f ("gtp: reload GTPv1 header after pskb_may_pull()")
Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 drivers/net/gtp.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index f7caf1e..4e976a0 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -1028,8 +1028,11 @@ static int gtp_genl_new_pdp(struct sk_buff *skb, struct genl_info *info)
 
 	/* Check if there's an existing gtpX device to configure */
 	dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
-	if (dev == NULL)
+	if (dev == NULL) {
+		put_net(net);
 		return -ENODEV;
+	}
+	put_net(net);
 
 	return ipv4_pdp_add(dev, info);
 }
@@ -1051,8 +1054,11 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)
 
 	/* Check if there's an existing gtpX device to configure */
 	dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
-	if (dev == NULL)
+	if (dev == NULL) {
+		put_net(net);
 		return -ENODEV;
+	}
+	put_net(net);
 
 	gtp = netdev_priv(dev);
 
@@ -1163,8 +1169,11 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info)
 
 	/* Check if there's an existing gtpX device to configure */
 	dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
-	if (dev == NULL)
+	if (dev == NULL) {
+		put_net(net);
 		return -ENODEV;
+	}
+	put_net(net);
 
 	gtp = netdev_priv(dev);
 
-- 
2.1.4

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

* Re: [PATCH net-next] gtp: put back reference to netns when not required anymore
  2016-05-12 15:16 [PATCH net-next] gtp: put back reference to netns when not required anymore Pablo Neira Ayuso
@ 2016-05-12 18:37 ` Cong Wang
  2016-05-12 19:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Cong Wang @ 2016-05-12 18:37 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Linux Kernel Network Developers, David Miller

On Thu, May 12, 2016 at 8:16 AM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> This patch fixes a netns leak.
>
> Fixes: 93edb8c7f94f ("gtp: reload GTPv1 header after pskb_may_pull()")
> Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>

Thanks.

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

* Re: [PATCH net-next] gtp: put back reference to netns when not required anymore
  2016-05-12 15:16 [PATCH net-next] gtp: put back reference to netns when not required anymore Pablo Neira Ayuso
  2016-05-12 18:37 ` Cong Wang
@ 2016-05-12 19:29 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-05-12 19:29 UTC (permalink / raw)
  To: pablo; +Cc: netdev, xiyou.wangcong

From: Pablo Neira Ayuso <pablo@netfilter.org>
Date: Thu, 12 May 2016 17:16:31 +0200

> This patch fixes a netns leak.
> 
> Fixes: 93edb8c7f94f ("gtp: reload GTPv1 header after pskb_may_pull()")
> Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Applied.

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

end of thread, other threads:[~2016-05-12 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-12 15:16 [PATCH net-next] gtp: put back reference to netns when not required anymore Pablo Neira Ayuso
2016-05-12 18:37 ` Cong Wang
2016-05-12 19:29 ` 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).