Skip to content

Commit

Permalink
l2tp: remove useless duplicate session detection in l2tp_netlink
Browse files Browse the repository at this point in the history
There's no point in checking for duplicate sessions at the beginning of
l2tp_nl_cmd_session_create(); the ->session_create() callbacks already
return -EEXIST when the session already exists.

Furthermore, even if l2tp_session_find() returns NULL, a new session
might be created right after the test. So relying on ->session_create()
to avoid duplicate session is the only sane behaviour.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Guillaume Nault authored and David S. Miller committed Apr 11, 2017
1 parent 93411c2 commit af87ae4
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions net/l2tp/l2tp_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
goto out;
}
session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
session = l2tp_session_find(net, tunnel, session_id);
if (session) {
ret = -EEXIST;
goto out;
}

if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID]) {
ret = -EINVAL;
Expand Down

0 comments on commit af87ae4

Please sign in to comment.