netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: Network Development <netdev@vger.kernel.org>
Subject: [PATCH] dl2k: Tighten ioctl permissions
Date: Wed, 25 Apr 2012 15:33:43 -0400	[thread overview]
Message-ID: <4F985197.1060607@suse.com> (raw)

 dl2k's rio_ioctl function defines several ioctls that involve
 operations that should be denied to regular users.

 SIOCDEVPRIVATE + 2 is a renumbered SIOCSMIIREG.
 SIOCDEVPRIVATE + 5 calls netif_stop_queue.
 SIOCDEVPRIVATE + 6 calls netif_wake_queue.

Reported-by: Stephan Mueller <stephan.mueller@atsec.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 drivers/net/ethernet/dlink/dl2k.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- a/drivers/net/ethernet/dlink/dl2k.c
+++ b/drivers/net/ethernet/dlink/dl2k.c
@@ -1264,6 +1264,14 @@ rio_ioctl (struct net_device *dev, struc
 	struct netdev_desc *desc;
 	int i;
 
+	switch (cmd) {
+	case SIOCDEVPRIVATE + 2:
+	case SIOCDEVPRIVATE + 5:
+	case SIOCDEVPRIVATE + 6:
+		if (!capable(CAP_NET_ADMIN))
+			return -EPERM;
+	};
+
 	phy_addr = np->phy_addr;
 	switch (cmd) {
 	case SIOCDEVPRIVATE:

-- 
Jeff Mahoney
SUSE Labs

             reply	other threads:[~2012-04-25 19:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-25 19:33 Jeff Mahoney [this message]
2012-04-25 22:26 ` [PATCH] dl2k: Tighten ioctl permissions Ben Hutchings
2012-04-25 22:29   ` David Miller
2012-04-25 22:37     ` Jeff Mahoney

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=4F985197.1060607@suse.com \
    --to=jeffm@suse.com \
    --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;
as well as URLs for NNTP newsgroup(s).