mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-05 17:01:17 +00:00
wan: Missing capability checks in sbni_ioctl()
There are missing capability checks in the following code: 1300 static int 1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd) 1302 { [...] 1319 case SIOCDEVRESINSTATS : 1320 if( current->euid != 0 ) /* root only */ 1321 return -EPERM; [...] 1336 case SIOCDEVSHWSTATE : 1337 if( current->euid != 0 ) /* root only */ 1338 return -EPERM; [...] 1357 case SIOCDEVENSLAVE : 1358 if( current->euid != 0 ) /* root only */ 1359 return -EPERM; [...] 1372 case SIOCDEVEMANSIPATE : 1373 if( current->euid != 0 ) /* root only */ 1374 return -EPERM; Here's my proposed fix: Missing capability checks. Signed-off-by: Eugene Teo <eugeneteo@kernel.sg> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6c36810a73
commit
f2455eb176
@ -1317,7 +1317,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCDEVRESINSTATS :
|
case SIOCDEVRESINSTATS :
|
||||||
if( current->euid != 0 ) /* root only */
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
|
memset( &nl->in_stats, 0, sizeof(struct sbni_in_stats) );
|
||||||
break;
|
break;
|
||||||
@ -1334,7 +1334,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SIOCDEVSHWSTATE :
|
case SIOCDEVSHWSTATE :
|
||||||
if( current->euid != 0 ) /* root only */
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
spin_lock( &nl->lock );
|
spin_lock( &nl->lock );
|
||||||
@ -1355,7 +1355,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
|
|||||||
#ifdef CONFIG_SBNI_MULTILINE
|
#ifdef CONFIG_SBNI_MULTILINE
|
||||||
|
|
||||||
case SIOCDEVENSLAVE :
|
case SIOCDEVENSLAVE :
|
||||||
if( current->euid != 0 ) /* root only */
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name ))
|
if (copy_from_user( slave_name, ifr->ifr_data, sizeof slave_name ))
|
||||||
@ -1370,7 +1370,7 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )
|
|||||||
return enslave( dev, slave_dev );
|
return enslave( dev, slave_dev );
|
||||||
|
|
||||||
case SIOCDEVEMANSIPATE :
|
case SIOCDEVEMANSIPATE :
|
||||||
if( current->euid != 0 ) /* root only */
|
if (!capable(CAP_NET_ADMIN))
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
return emancipate( dev );
|
return emancipate( dev );
|
||||||
|
Loading…
Reference in New Issue
Block a user