mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-kernel@vger.kernel.org
Cc: David Miller <davem@davemloft.net>,
	Christoph Hellwig <hch@lst.de>,
	netdev@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 7/7] net, compat_ioctl: handle more ioctls correctly
Date: Fri,  6 Nov 2009 19:09:09 +0100	[thread overview]
Message-ID: <1257530949-9695-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1257530949-9695-1-git-send-email-arnd@arndb.de>

The MII ioctls and SIOCSIFNAME need to go through ifsioc conversion,
which they never did so far. Some others are not implemented in the
native path, so we can just return -EINVAL directly.

Add IFSLAVE ioctls to the EINVAL list and move it to the end to
optimize the code path for the common case.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/socket.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/net/socket.c b/net/socket.c
index 2621213..688de5d 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2911,11 +2911,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
 		return do_siocgstamp(net, sock, cmd, argp);
 	case SIOCGSTAMPNS:
 		return do_siocgstampns(net, sock, cmd, argp);
-/* Note SIOCRTMSG is no longer, so this is safe and
- * the user would have seen just an -EINVAL anyways. */
-	case SIOCRTMSG:
-	case SIOCGIFCOUNT:
-		return -EINVAL;
 
 	case FIOSETOWN:
 	case SIOCSPGRP:
@@ -2949,8 +2944,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
 	case SIOCSIFHWBROADCAST:
 	case SIOCSHWTSTAMP:
 	case SIOCDIFADDR:
-/*	case SIOCSARP: duplicate */
-/*	case SIOCDARP: duplicate */
 	case SIOCGIFBRDADDR:
 	case SIOCSIFBRDADDR:
 	case SIOCGIFDSTADDR:
@@ -2963,7 +2956,12 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
 	case SIOCSIFTXQLEN:
 	case SIOCBRADDIF:
 	case SIOCBRDELIF:
+	case SIOCSIFNAME:
+	case SIOCGMIIPHY:
+	case SIOCGMIIREG:
+	case SIOCSMIIREG:
 		return dev_ifsioc(net, sock, cmd, argp);
+
 	case ATM_GETLINKRATE32:
 	case ATM_GETNAMES32:
 	case ATM_GETTYPE32:
@@ -3010,17 +3008,22 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
 	case SIOCSARP:
 	case SIOCGARP:
 	case SIOCDARP:
-
 	case SIOCATMARK:
-	case SIOCSIFLINK:
-	case SIOCSIFNAME:
+		return sock_do_ioctl(net, sock, cmd, arg);
+	}
+
+	/* Prevent warning from compat_sys_ioctl, these always
+	 * result in -EINVAL in the native case anyway. */
+	switch (cmd) {
+	case SIOCRTMSG:
+	case SIOCGIFCOUNT:
 	case SIOCSRARP:
 	case SIOCGRARP:
 	case SIOCDRARP:
-	case SIOCGMIIPHY:
-	case SIOCGMIIREG:
-	case SIOCSMIIREG:
-		return sock_do_ioctl(net, sock, cmd, arg);
+	case SIOCSIFLINK:
+	case SIOCGIFSLAVE:
+	case SIOCSIFSLAVE:
+		return -EINVAL;
 	}
 
 	return -ENOIOCTLCMD;
-- 
1.6.3.3


  parent reply	other threads:[~2009-11-06 18:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06 18:09 [RFC, PATCH 0/7] net, compat_ioctl: move handlers to net/socket.c Arnd Bergmann
2009-11-06 18:09 ` [PATCH 1/7] compat: add struct compat_ifreq etc to compat.h Arnd Bergmann
2009-11-06 18:17   ` Daniel Walker
2009-11-06 18:09 ` [PATCH 2/7] net/tun: handle compat_ioctl directly Arnd Bergmann
2009-11-06 18:09 ` [PATCH 3/7] net, compat_ioctl: handle socket ioctl abuses in tty drivers Arnd Bergmann
2009-11-06 18:09 ` [PATCH 4/7] appletalk: handle SIOCATALKDIFADDR compat ioctl Arnd Bergmann
2009-11-06 18:09 ` [PATCH 5/7] copy socket ioctl code to net/socket.h Arnd Bergmann
2009-11-06 18:09 ` [PATCH 6/7] compat: move sockios handling to net/socket.c Arnd Bergmann
2009-11-06 18:09 ` Arnd Bergmann [this message]
2009-11-07  4:47 ` [RFC, PATCH 0/7] net, compat_ioctl: move handlers " David Miller
2009-11-08 21:31   ` Arnd Bergmann
2009-11-08 21:34     ` [PATCH 1/2] net, compat_ioctl: fix SIOCGMII ioctls Arnd Bergmann
2009-11-09  4:56       ` David Miller
2009-11-08 21:39     ` [PATCH 2/2] net/compat_ioctl: support SIOCWANDEV Arnd Bergmann
2009-11-09  4:57       ` David Miller
2009-11-09 14:48       ` Krzysztof Halasa
2009-11-09  4:55     ` [RFC, PATCH 0/7] net, compat_ioctl: move handlers to net/socket.c David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257530949-9695-8-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®