l2tp: remove ->ref() and ->deref()
The ->ref() and ->deref() callbacks are unused since PPP stopped using
them in ee40fb2e1e
("l2tp: protect sock pointer of struct pppol2tp_session with RCU").
We can thus remove them from struct l2tp_session and drop the do_ref
parameter of l2tp_session_get*().
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
aa2bc739ef
commit
a4346210c4
@@ -48,8 +48,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq,
|
||||
/* Accessed under genl lock */
|
||||
static const struct l2tp_nl_cmd_ops *l2tp_nl_cmd_ops[__L2TP_PWTYPE_MAX];
|
||||
|
||||
static struct l2tp_session *l2tp_nl_session_get(struct genl_info *info,
|
||||
bool do_ref)
|
||||
static struct l2tp_session *l2tp_nl_session_get(struct genl_info *info)
|
||||
{
|
||||
u32 tunnel_id;
|
||||
u32 session_id;
|
||||
@@ -60,15 +59,14 @@ static struct l2tp_session *l2tp_nl_session_get(struct genl_info *info,
|
||||
|
||||
if (info->attrs[L2TP_ATTR_IFNAME]) {
|
||||
ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
|
||||
session = l2tp_session_get_by_ifname(net, ifname, do_ref);
|
||||
session = l2tp_session_get_by_ifname(net, ifname);
|
||||
} else if ((info->attrs[L2TP_ATTR_SESSION_ID]) &&
|
||||
(info->attrs[L2TP_ATTR_CONN_ID])) {
|
||||
tunnel_id = nla_get_u32(info->attrs[L2TP_ATTR_CONN_ID]);
|
||||
session_id = nla_get_u32(info->attrs[L2TP_ATTR_SESSION_ID]);
|
||||
tunnel = l2tp_tunnel_get(net, tunnel_id);
|
||||
if (tunnel) {
|
||||
session = l2tp_session_get(net, tunnel, session_id,
|
||||
do_ref);
|
||||
session = l2tp_session_get(net, tunnel, session_id);
|
||||
l2tp_tunnel_dec_refcount(tunnel);
|
||||
}
|
||||
}
|
||||
@@ -649,7 +647,7 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
|
||||
&cfg);
|
||||
|
||||
if (ret >= 0) {
|
||||
session = l2tp_session_get(net, tunnel, session_id, false);
|
||||
session = l2tp_session_get(net, tunnel, session_id);
|
||||
if (session) {
|
||||
ret = l2tp_session_notify(&l2tp_nl_family, info, session,
|
||||
L2TP_CMD_SESSION_CREATE);
|
||||
@@ -669,7 +667,7 @@ static int l2tp_nl_cmd_session_delete(struct sk_buff *skb, struct genl_info *inf
|
||||
struct l2tp_session *session;
|
||||
u16 pw_type;
|
||||
|
||||
session = l2tp_nl_session_get(info, true);
|
||||
session = l2tp_nl_session_get(info);
|
||||
if (session == NULL) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
@@ -683,8 +681,6 @@ static int l2tp_nl_cmd_session_delete(struct sk_buff *skb, struct genl_info *inf
|
||||
if (l2tp_nl_cmd_ops[pw_type] && l2tp_nl_cmd_ops[pw_type]->session_delete)
|
||||
ret = (*l2tp_nl_cmd_ops[pw_type]->session_delete)(session);
|
||||
|
||||
if (session->deref)
|
||||
session->deref(session);
|
||||
l2tp_session_dec_refcount(session);
|
||||
|
||||
out:
|
||||
@@ -696,7 +692,7 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf
|
||||
int ret = 0;
|
||||
struct l2tp_session *session;
|
||||
|
||||
session = l2tp_nl_session_get(info, false);
|
||||
session = l2tp_nl_session_get(info);
|
||||
if (session == NULL) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
@@ -828,7 +824,7 @@ static int l2tp_nl_cmd_session_get(struct sk_buff *skb, struct genl_info *info)
|
||||
struct sk_buff *msg;
|
||||
int ret;
|
||||
|
||||
session = l2tp_nl_session_get(info, false);
|
||||
session = l2tp_nl_session_get(info);
|
||||
if (session == NULL) {
|
||||
ret = -ENODEV;
|
||||
goto err;
|
||||
@@ -874,7 +870,7 @@ static int l2tp_nl_cmd_session_dump(struct sk_buff *skb, struct netlink_callback
|
||||
goto out;
|
||||
}
|
||||
|
||||
session = l2tp_session_get_nth(tunnel, si, false);
|
||||
session = l2tp_session_get_nth(tunnel, si);
|
||||
if (session == NULL) {
|
||||
ti++;
|
||||
tunnel = NULL;
|
||||
|
Reference in New Issue
Block a user