The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* PROBLEM: plip_ioctl do not check cmd param equal to SIOCDEVPLIP
@ 2004-06-01 23:07 sylvain ferriol
  0 siblings, 0 replies; only message in thread
From: sylvain ferriol @ 2004-06-01 23:07 UTC (permalink / raw)
  To: linux-kernel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-01 23:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-01 23:07 PROBLEM: plip_ioctl do not check cmd param equal to SIOCDEVPLIP sylvain ferriol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox