浏览代码

l2tp: drop ->flags from struct pppol2tp_session

This field is not used.

Keep validating user input in PPPIOCSFLAGS. Even though we discard the
value, it would look wrong to succeed if an invalid address was passed
from userspace.

Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Guillaume Nault 7 年之前
父节点
当前提交
1998b5ed9c
共有 1 个文件被更改,包括 2 次插入11 次删除
  1. 2 11
      net/l2tp/l2tp_ppp.c

+ 2 - 11
net/l2tp/l2tp_ppp.c

@@ -127,8 +127,6 @@ struct pppol2tp_session {
 						 * PPPoX socket */
 						 * PPPoX socket */
 	struct sock		*__sk;		/* Copy of .sk, for cleanup */
 	struct sock		*__sk;		/* Copy of .sk, for cleanup */
 	struct rcu_head		rcu;		/* For asynchronous release */
 	struct rcu_head		rcu;		/* For asynchronous release */
-	int			flags;		/* accessed by PPPIOCGFLAGS.
-						 * Unused. */
 };
 };
 
 
 static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
 static int pppol2tp_xmit(struct ppp_channel *chan, struct sk_buff *skb);
@@ -1057,7 +1055,6 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
 	int err = 0;
 	int err = 0;
 	struct sock *sk;
 	struct sock *sk;
 	int val = (int) arg;
 	int val = (int) arg;
-	struct pppol2tp_session *ps = l2tp_session_priv(session);
 	struct l2tp_tunnel *tunnel = session->tunnel;
 	struct l2tp_tunnel *tunnel = session->tunnel;
 	struct pppol2tp_ioc_stats stats;
 	struct pppol2tp_ioc_stats stats;
 
 
@@ -1134,21 +1131,15 @@ static int pppol2tp_session_ioctl(struct l2tp_session *session,
 
 
 	case PPPIOCGFLAGS:
 	case PPPIOCGFLAGS:
 		err = -EFAULT;
 		err = -EFAULT;
-		if (put_user(ps->flags, (int __user *) arg))
+		if (put_user(0, (int __user *)arg))
 			break;
 			break;
-
-		l2tp_info(session, L2TP_MSG_CONTROL, "%s: get flags=%d\n",
-			  session->name, ps->flags);
 		err = 0;
 		err = 0;
 		break;
 		break;
 
 
 	case PPPIOCSFLAGS:
 	case PPPIOCSFLAGS:
 		err = -EFAULT;
 		err = -EFAULT;
-		if (get_user(val, (int __user *) arg))
+		if (get_user(val, (int __user *)arg))
 			break;
 			break;
-		ps->flags = val;
-		l2tp_info(session, L2TP_MSG_CONTROL, "%s: set flags=%d\n",
-			  session->name, ps->flags);
 		err = 0;
 		err = 0;
 		break;
 		break;