Skip to content

Commit

Permalink
gtp: put back reference to netns when not required anymore
Browse files Browse the repository at this point in the history
This patch fixes a netns leak.

Fixes: 93edb8c ("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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pablo Neira authored and David S. Miller committed May 12, 2016
1 parent 7fd3819 commit 27ee441
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drivers/net/gtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 27ee441

Please sign in to comment.