|
@@ -444,34 +444,37 @@ static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info)
|
|
|
|
|
|
if (!info->attrs[L2TP_ATTR_CONN_ID]) {
|
|
if (!info->attrs[L2TP_ATTR_CONN_ID]) {
|
|
ret = -EINVAL;
|
|
ret = -EINVAL;
|
|
- goto out;
|
|
|
|
|
|
+ goto err;
|
|
}
|
|
}
|
|
|
|
|
|
tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
|
|
tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
|
|
|
|
|
|
- tunnel = l2tp_tunnel_find(net, tunnel_id);
|
|
|
|
- if (tunnel == NULL) {
|
|
|
|
- ret = -ENODEV;
|
|
|
|
- goto out;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
|
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
|
|
if (!msg) {
|
|
if (!msg) {
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
- goto out;
|
|
|
|
|
|
+ goto err;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tunnel = l2tp_tunnel_get(net, tunnel_id);
|
|
|
|
+ if (!tunnel) {
|
|
|
|
+ ret = -ENODEV;
|
|
|
|
+ goto err_nlmsg;
|
|
}
|
|
}
|
|
|
|
|
|
ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
|
|
ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
|
|
NLM_F_ACK, tunnel, L2TP_CMD_TUNNEL_GET);
|
|
NLM_F_ACK, tunnel, L2TP_CMD_TUNNEL_GET);
|
|
if (ret < 0)
|
|
if (ret < 0)
|
|
- goto err_out;
|
|
|
|
|
|
+ goto err_nlmsg_tunnel;
|
|
|
|
+
|
|
|
|
+ l2tp_tunnel_dec_refcount(tunnel);
|
|
|
|
|
|
return genlmsg_unicast(net, msg, info->snd_portid);
|
|
return genlmsg_unicast(net, msg, info->snd_portid);
|
|
|
|
|
|
-err_out:
|
|
|
|
|
|
+err_nlmsg_tunnel:
|
|
|
|
+ l2tp_tunnel_dec_refcount(tunnel);
|
|
|
|
+err_nlmsg:
|
|
nlmsg_free(msg);
|
|
nlmsg_free(msg);
|
|
-
|
|
|
|
-out:
|
|
|
|
|
|
+err:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|