lkml.org 
[lkml]   [2000]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] af_econet.c: s/suser/capable/ + micro cleanup
Hi,

Please consider applying.

- Arnaldo

--- linux-2.4.0-test7/net/econet/af_econet.c Fri Jul 28 06:35:01 2000
+++ linux-2.4.0-test7.acme/net/econet/af_econet.c Sun Aug 27 11:48:00 2000
@@ -641,17 +641,15 @@
static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;
- int err;
int pid;

switch(cmd)
{
case FIOSETOWN:
case SIOCSPGRP:
- err = get_user(pid, (int *) arg);
- if (err)
- return err;
- if (current->pid != pid && current->pgrp != -pid && !suser())
+ if (get_user(pid, (int *) arg))
+ return -EFAULT;
+ if (current->pid != pid && current->pgrp != -pid && !capable(CAP_NET_ADMIN))
return -EPERM;
sk->proc = pid;
return(0);
@@ -661,10 +659,7 @@
case SIOCGSTAMP:
if(sk->stamp.tv_sec==0)
return -ENOENT;
- err = -EFAULT;
- if (!copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)))
- err = 0;
- return err;
+ return copy_to_user((void *)arg, &sk->stamp, sizeof(struct timeval)) ? -EFAULT : 0;
case SIOCGIFFLAGS:
case SIOCSIFFLAGS:
case SIOCGIFCONF:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.031 / U:5.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site