aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira <pablo@netfilter.org>2016-05-12 11:16:31 -0400
committerDavid S. Miller <davem@davemloft.net>2016-05-12 12:27:15 -0400
commit27ee441a43392ebe5b027fe5d78640e839673d21 (patch)
tree2b845961ddc3d5af1964f2373b4f9f79361fb56e
parent7fd38193d0473acc6e8f108107d0466f07768853 (diff)
gtp: put back reference to netns when not required anymore
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/gtp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index f7caf1e35d83..4e976a0d5a76 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)
1028 1028
1029 /* Check if there's an existing gtpX device to configure */ 1029 /* Check if there's an existing gtpX device to configure */
1030 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK])); 1030 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
1031 if (dev == NULL) 1031 if (dev == NULL) {
1032 put_net(net);
1032 return -ENODEV; 1033 return -ENODEV;
1034 }
1035 put_net(net);
1033 1036
1034 return ipv4_pdp_add(dev, info); 1037 return ipv4_pdp_add(dev, info);
1035} 1038}
@@ -1051,8 +1054,11 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)
1051 1054
1052 /* Check if there's an existing gtpX device to configure */ 1055 /* Check if there's an existing gtpX device to configure */
1053 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK])); 1056 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
1054 if (dev == NULL) 1057 if (dev == NULL) {
1058 put_net(net);
1055 return -ENODEV; 1059 return -ENODEV;
1060 }
1061 put_net(net);
1056 1062
1057 gtp = netdev_priv(dev); 1063 gtp = netdev_priv(dev);
1058 1064
@@ -1163,8 +1169,11 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info)
1163 1169
1164 /* Check if there's an existing gtpX device to configure */ 1170 /* Check if there's an existing gtpX device to configure */
1165 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK])); 1171 dev = gtp_find_dev(net, nla_get_u32(info->attrs[GTPA_LINK]));
1166 if (dev == NULL) 1172 if (dev == NULL) {
1173 put_net(net);
1167 return -ENODEV; 1174 return -ENODEV;
1175 }
1176 put_net(net);
1168 1177
1169 gtp = netdev_priv(dev); 1178 gtp = netdev_priv(dev);
1170 1179