The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: sylvain ferriol <sylvain.ferriol@imag.fr>
To: linux-kernel@vger.kernel.org
Subject: PROBLEM: plip_ioctl do not check cmd param equal to SIOCDEVPLIP
Date: Wed, 02 Jun 2004 01:07:56 +0200	[thread overview]
Message-ID: <40BD0C4C.3010608@imag.fr> (raw)

as plip_ioctl do not check the command in cmd parameter, it can return 0 
to an ioctl access which is not for him.

example: in wireless-tools package
to check if the network interface is a wireless interface,
the wireless tool send an ioctl with cmd=SIOCGIWNAME

as plip_ioctl do not have a 'switch case' on cmd param, it returns 0
=> plip is assigned as a wireless interface => bug

One example code fix:
static int
plip_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{
    struct net_local *nl = (struct net_local *) dev->priv;
    struct plipconf *pc = (struct plipconf *) &rq->ifr_data;

+    if(cmd !=  SIOCDEVPLIP) {
+      return -EOPNOTSUPP;
+    }

    switch(pc->pcmd) {
    case PLIP_GET_TIMEOUT:
        pc->trigger = nl->trigger;
        pc->nibble  = nl->nibble;
        break;
    case PLIP_SET_TIMEOUT:
        if(!capable(CAP_NET_ADMIN))
            return -EPERM;
        nl->trigger = pc->trigger;
        nl->nibble  = pc->nibble;
        break;
    default:
        return -EOPNOTSUPP;
    }
    return 0;
}

thanks
sylvain ferriol

Keywords:  module, plip, networking
Kernel version: 2.4.26


                 reply	other threads:[~2004-06-01 23:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=40BD0C4C.3010608@imag.fr \
    --to=sylvain.ferriol@imag.fr \
    --cc=linux-kernel@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