Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
2b130d1b
Commit
2b130d1b
authored
Nov 23, 2007
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import 1.1.44
parent
bc1cbadf
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
253 additions
and
226 deletions
+253
-226
Makefile
Makefile
+1
-1
drivers/block/floppy.c
drivers/block/floppy.c
+1
-1
drivers/block/hd.c
drivers/block/hd.c
+1
-1
drivers/char/console.c
drivers/char/console.c
+2
-2
drivers/char/serial.c
drivers/char/serial.c
+16
-16
drivers/char/tpqic02.c
drivers/char/tpqic02.c
+1
-1
drivers/char/tty_io.c
drivers/char/tty_io.c
+9
-9
drivers/char/vt.c
drivers/char/vt.c
+1
-1
drivers/net/8390.c
drivers/net/8390.c
+2
-11
drivers/net/plip.c
drivers/net/plip.c
+2
-2
drivers/net/ppp.c
drivers/net/ppp.c
+2
-2
drivers/net/slip.c
drivers/net/slip.c
+1
-1
drivers/scsi/hosts.c
drivers/scsi/hosts.c
+1
-1
drivers/scsi/scsicam.c
drivers/scsi/scsicam.c
+1
-1
drivers/sound/soundcard.c
drivers/sound/soundcard.c
+1
-1
fs/buffer.c
fs/buffer.c
+1
-1
fs/exec.c
fs/exec.c
+3
-4
fs/ext/freelists.c
fs/ext/freelists.c
+2
-2
fs/ext/namei.c
fs/ext/namei.c
+11
-11
fs/ext2/acl.c
fs/ext2/acl.c
+2
-2
fs/ext2/balloc.c
fs/ext2/balloc.c
+1
-1
fs/ext2/ialloc.c
fs/ext2/ialloc.c
+2
-2
fs/ext2/ioctl.c
fs/ext2/ioctl.c
+2
-2
fs/ext2/namei.c
fs/ext2/namei.c
+11
-11
fs/inode.c
fs/inode.c
+2
-2
fs/minix/bitmap.c
fs/minix/bitmap.c
+2
-2
fs/minix/namei.c
fs/minix/namei.c
+11
-11
fs/namei.c
fs/namei.c
+6
-5
fs/nfs/proc.c
fs/nfs/proc.c
+16
-16
fs/open.c
fs/open.c
+28
-39
fs/sysv/ialloc.c
fs/sysv/ialloc.c
+2
-2
fs/sysv/namei.c
fs/sysv/namei.c
+11
-11
fs/umsdos/namei.c
fs/umsdos/namei.c
+4
-4
fs/xiafs/bitmap.c
fs/xiafs/bitmap.c
+2
-2
fs/xiafs/namei.c
fs/xiafs/namei.c
+11
-11
include/asm/segment.h
include/asm/segment.h
+1
-1
include/linux/kernel.h
include/linux/kernel.h
+5
-0
include/linux/sched.h
include/linux/sched.h
+3
-3
include/linux/skbuff.h
include/linux/skbuff.h
+1
-1
include/linux/string.h
include/linux/string.h
+6
-0
include/linux/unistd.h
include/linux/unistd.h
+2
-0
kernel/sys.c
kernel/sys.c
+36
-5
kernel/sys_call.S
kernel/sys_call.S
+2
-0
mm/mmap.c
mm/mmap.c
+2
-1
mm/mprotect.c
mm/mprotect.c
+22
-22
net/inet/eth.c
net/inet/eth.c
+1
-1
No files found.
Makefile
View file @
2b130d1b
VERSION
=
1
PATCHLEVEL
=
1
SUBLEVEL
=
4
3
SUBLEVEL
=
4
4
all
:
Version zImage
...
...
drivers/block/floppy.c
View file @
2b130d1b
...
...
@@ -1523,7 +1523,7 @@ static void setup_format_params(void)
{
struct
fparm
{
unsigned
char
track
,
head
,
sect
,
size
;
}
*
here
=
(
void
*
)
floppy_track_buffer
;
}
*
here
=
(
struct
fparm
*
)
floppy_track_buffer
;
int
ssize
,
il
,
n
;
int
count
,
head_shift
,
track_shift
;
...
...
drivers/block/hd.c
View file @
2b130d1b
...
...
@@ -278,7 +278,7 @@ static void identify_intr(void)
id
.
cyls
*
id
.
heads
*
id
.
sectors
/
2048
,
id
.
buf_size
/
2
,
hd_info
[
dev
].
cyl
,
hd_info
[
dev
].
head
,
hd_info
[
dev
].
sect
,
id
.
max_multsect
);
/* save drive info for later query via HDIO_GETIDENTITY */
if
(
NULL
!=
(
hd_ident_info
[
dev
]
=
kmalloc
(
sizeof
(
id
),
GFP_ATOMIC
)))
if
(
NULL
!=
(
hd_ident_info
[
dev
]
=
(
struct
hd_driveid
*
)
kmalloc
(
sizeof
(
id
),
GFP_ATOMIC
)))
*
hd_ident_info
[
dev
]
=
id
;
/* flush remaining 384 (reserved/undefined) ID bytes: */
...
...
drivers/char/console.c
View file @
2b130d1b
...
...
@@ -1103,7 +1103,7 @@ static int con_write(struct tty_struct * tty, int from_user,
{
int
c
,
n
=
0
;
unsigned
int
currcons
;
struct
vt_struct
*
vt
=
tty
->
driver_data
;
struct
vt_struct
*
vt
=
(
struct
vt_struct
*
)
tty
->
driver_data
;
currcons
=
vt
->
vc_num
;
if
(
currcons
>=
NR_CONSOLES
)
{
...
...
@@ -1834,7 +1834,7 @@ static void highlight(const int currcons, const int s, const int e)
static
void
highlight_pointer
(
const
int
currcons
,
const
int
where
)
{
unsigned
char
*
p
;
static
char
*
prev
=
NULL
;
static
unsigned
char
*
prev
=
NULL
;
if
(
where
==-
1
)
/* remove the pointer */
{
...
...
drivers/char/serial.c
View file @
2b130d1b
...
...
@@ -290,7 +290,7 @@ static inline void serial_outp(struct async_struct *info, int offset,
*/
static
void
rs_stop
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
unsigned
long
flags
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_stop"
))
...
...
@@ -306,7 +306,7 @@ static void rs_stop(struct tty_struct *tty)
static
void
rs_start
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
unsigned
long
flags
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_start"
))
...
...
@@ -694,9 +694,9 @@ static void do_serial_bh(void *unused)
run_task_queue
(
&
tq_serial
);
}
static
void
do_softint
(
void
*
private
)
static
void
do_softint
(
void
*
private
_
)
{
struct
async_struct
*
info
=
(
struct
async_struct
*
)
private
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
private
_
;
struct
tty_struct
*
tty
;
tty
=
info
->
tty
;
...
...
@@ -1185,7 +1185,7 @@ static void change_speed(struct async_struct *info)
static
void
rs_put_char
(
struct
tty_struct
*
tty
,
unsigned
char
ch
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
unsigned
long
flags
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_put_char"
))
...
...
@@ -1208,7 +1208,7 @@ static void rs_put_char(struct tty_struct *tty, unsigned char ch)
static
void
rs_flush_chars
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
unsigned
long
flags
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_flush_chars"
))
...
...
@@ -1228,7 +1228,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
unsigned
char
*
buf
,
int
count
)
{
int
c
,
total
=
0
;
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
unsigned
long
flags
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_write"
))
...
...
@@ -1272,7 +1272,7 @@ static int rs_write(struct tty_struct * tty, int from_user,
static
int
rs_write_room
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
int
ret
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_write_room"
))
...
...
@@ -1285,7 +1285,7 @@ static int rs_write_room(struct tty_struct *tty)
static
int
rs_chars_in_buffer
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_chars_in_buffer"
))
return
0
;
...
...
@@ -1294,7 +1294,7 @@ static int rs_chars_in_buffer(struct tty_struct *tty)
static
void
rs_flush_buffer
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_flush_buffer"
))
return
;
...
...
@@ -1317,7 +1317,7 @@ static void rs_flush_buffer(struct tty_struct *tty)
*/
static
void
rs_throttle
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
#ifdef SERIAL_DEBUG_THROTTLE
char
buf
[
64
];
...
...
@@ -1340,7 +1340,7 @@ static void rs_throttle(struct tty_struct * tty)
static
void
rs_unthrottle
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
#ifdef SERIAL_DEBUG_THROTTLE
char
buf
[
64
];
...
...
@@ -1627,7 +1627,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
unsigned
int
cmd
,
unsigned
long
arg
)
{
int
error
;
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
int
retval
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_ioctl"
))
...
...
@@ -1718,7 +1718,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
static
void
rs_set_termios
(
struct
tty_struct
*
tty
,
struct
termios
*
old_termios
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
if
(
tty
->
termios
->
c_cflag
==
old_termios
->
c_cflag
)
return
;
...
...
@@ -1748,7 +1748,7 @@ static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
*/
static
void
rs_close
(
struct
tty_struct
*
tty
,
struct
file
*
filp
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
if
(
!
info
||
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_close"
))
return
;
...
...
@@ -1822,7 +1822,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
*/
void
rs_hangup
(
struct
tty_struct
*
tty
)
{
struct
async_struct
*
info
=
tty
->
driver_data
;
struct
async_struct
*
info
=
(
struct
async_struct
*
)
tty
->
driver_data
;
if
(
serial_paranoia_check
(
info
,
tty
->
device
,
"rs_hangup"
))
return
;
...
...
drivers/char/tpqic02.c
View file @
2b130d1b
...
...
@@ -2832,7 +2832,7 @@ static int qic02_get_resources(void)
*/
/* get IRQ */
if
(
request_irq
(
QIC02_TAPE_IRQ
,
qic02_tape_interrupt
,
SA_INTERRUP
,
"QIC-02"
))
{
if
(
request_irq
(
QIC02_TAPE_IRQ
,
qic02_tape_interrupt
,
SA_INTERRUP
T
,
"QIC-02"
))
{
printk
(
TPQIC02_NAME
": can't allocate IRQ%d for QIC-02 tape
\n
"
,
QIC02_TAPE_IRQ
);
status_zombie
=
YES
;
...
...
drivers/char/tty_io.c
View file @
2b130d1b
...
...
@@ -634,7 +634,7 @@ static int tty_read(struct inode * inode, struct file * file, char * buf, int co
int
i
;
struct
tty_struct
*
tty
;
tty
=
file
->
private_data
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
->
i_rdev
,
"tty_read"
))
return
-
EIO
;
if
(
!
tty
||
(
tty
->
flags
&
(
1
<<
TTY_IO_ERROR
)))
...
...
@@ -676,7 +676,7 @@ static int tty_write(struct inode * inode, struct file * file, char * buf, int c
if
(
is_console
&&
redirect
)
tty
=
redirect
;
else
tty
=
file
->
private_data
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
->
i_rdev
,
"tty_write"
))
return
-
EIO
;
if
(
!
tty
||
!
tty
->
driver
.
write
||
(
tty
->
flags
&
(
1
<<
TTY_IO_ERROR
)))
...
...
@@ -886,7 +886,7 @@ static void release_dev(struct file * filp)
int
idx
;
tty
=
filp
->
private_data
;
tty
=
(
struct
tty_struct
*
)
filp
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
filp
->
f_inode
->
i_rdev
,
"release_dev"
))
return
;
...
...
@@ -1136,7 +1136,7 @@ static int tty_select(struct inode * inode, struct file * filp, int sel_type, se
{
struct
tty_struct
*
tty
;
tty
=
filp
->
private_data
;
tty
=
(
struct
tty_struct
*
)
filp
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
->
i_rdev
,
"tty_select"
))
return
0
;
...
...
@@ -1150,7 +1150,7 @@ static int tty_fasync(struct inode * inode, struct file * filp, int on)
struct
tty_struct
*
tty
;
struct
fasync_struct
*
fa
,
*
prev
;
tty
=
filp
->
private_data
;
tty
=
(
struct
tty_struct
*
)
filp
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
->
i_rdev
,
"tty_fasync"
))
return
0
;
...
...
@@ -1162,7 +1162,7 @@ static int tty_fasync(struct inode * inode, struct file * filp, int on)
if
(
on
)
{
if
(
fa
)
return
0
;
fa
=
kmalloc
(
sizeof
(
struct
fasync_struct
),
GFP_KERNEL
);
fa
=
(
struct
fasync_struct
*
)
kmalloc
(
sizeof
(
struct
fasync_struct
),
GFP_KERNEL
);
if
(
!
fa
)
return
-
ENOMEM
;
fa
->
magic
=
FASYNC_MAGIC
;
...
...
@@ -1228,7 +1228,7 @@ static int tty_ioctl(struct inode * inode, struct file * file,
unsigned
char
ch
;
char
mbz
=
0
;
tty
=
file
->
private_data
;
tty
=
(
struct
tty_struct
*
)
file
->
private_data
;
if
(
tty_paranoia_check
(
tty
,
inode
->
i_rdev
,
"tty_ioctl"
))
return
-
EINVAL
;
...
...
@@ -1466,9 +1466,9 @@ void do_SAK( struct tty_struct *tty)
* This routine is called out of the software interrupt to flush data
* from the flip buffer to the line discipline.
*/
static
void
flush_to_ldisc
(
void
*
private
)
static
void
flush_to_ldisc
(
void
*
private
_
)
{
struct
tty_struct
*
tty
=
private
;
struct
tty_struct
*
tty
=
(
struct
tty_struct
*
)
private_
;
unsigned
char
*
cp
;
char
*
fp
;
int
count
;
...
...
drivers/char/vt.c
View file @
2b130d1b
...
...
@@ -121,7 +121,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
int
console
,
i
;
unsigned
char
ucval
;
struct
kbd_struct
*
kbd
;
struct
vt_struct
*
vt
=
tty
->
driver_data
;
struct
vt_struct
*
vt
=
(
struct
vt_struct
*
)
tty
->
driver_data
;
console
=
vt
->
vc_num
;
...
...
drivers/net/8390.c
View file @
2b130d1b
...
...
@@ -134,15 +134,12 @@ static int ei_start_xmit(struct sk_buff *skb, struct device *dev)
the board has died and kick it. */
if
(
dev
->
tbusy
)
{
/* Do timeouts, just like the 8003 driver. */
int
txsr
=
inb
(
e8390_base
+
EN0_TSR
),
isr
,
cmd
;
int
txsr
=
inb
(
e8390_base
+
EN0_TSR
),
isr
;
int
tickssofar
=
jiffies
-
dev
->
trans_start
;
if
(
tickssofar
<
10
||
(
tickssofar
<
15
&&
!
(
txsr
&
ENTSR_PTX
)))
{
return
1
;
}
isr
=
inb
(
e8390_base
+
EN0_ISR
);
cmd
=
inb
(
e8390_base
+
E8390_CMD
)
&
(
E8390_STOP
|
E8390_START
);
if
((
cmd
==
0
)
||
(
cmd
==
(
E8390_STOP
|
E8390_START
)))
return
1
;
printk
(
KERN_DEBUG
"%s: transmit timed out, TX status %#2x, ISR %#2x.
\n
"
,
dev
->
name
,
txsr
,
isr
);
/* Does the 8390 thinks it has posted an interrupt? */
...
...
@@ -245,7 +242,7 @@ void ei_interrupt(int reg_ptr)
int
irq
=
-
(((
struct
pt_regs
*
)
reg_ptr
)
->
orig_eax
+
2
);
struct
device
*
dev
=
(
struct
device
*
)(
irq2dev_map
[
irq
]);
int
e8390_base
;
int
interrupts
,
cmd
,
boguscount
=
0
;
int
interrupts
,
boguscount
=
0
;
struct
ei_device
*
ei_local
;
if
(
dev
==
NULL
)
{
...
...
@@ -277,12 +274,6 @@ void ei_interrupt(int reg_ptr)
/* !!Assumption!! -- we stay in page 0. Don't break this. */
while
((
interrupts
=
inb_p
(
e8390_base
+
EN0_ISR
))
!=
0
&&
++
boguscount
<
9
)
{
cmd
=
inb
(
e8390_base
+
E8390_CMD
)
&
(
E8390_STOP
|
E8390_START
);
if
((
cmd
==
0
)
||
(
cmd
==
(
E8390_STOP
|
E8390_START
)))
{
printk
(
"%s: card not present
\n
"
,
dev
->
name
);
interrupts
=
0
;
break
;
}
if
(
interrupts
&
ENISR_RDC
)
{
/* Ack meaningless DMA complete. */
outb_p
(
ENISR_RDC
,
e8390_base
+
EN0_ISR
);
...
...
drivers/net/plip.c
View file @
2b130d1b
...
...
@@ -232,7 +232,7 @@ plip_init(struct device *dev)
dev
->
priv
=
kmalloc
(
sizeof
(
struct
net_local
),
GFP_KERNEL
);
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_local
));
pl
=
dev
->
priv
;
pl
=
(
struct
net_local
*
)
dev
->
priv
;
pl
->
trigger_us
=
PLIP_TRIGGER_WAIT
;
pl
->
nibble_us
=
PLIP_NIBBLE_WAIT
;
...
...
@@ -693,7 +693,7 @@ static void
plip_interrupt
(
int
reg_ptr
)
{
int
irq
=
-
(((
struct
pt_regs
*
)
reg_ptr
)
->
orig_eax
+
2
);
struct
device
*
dev
=
irq2dev_map
[
irq
];
struct
device
*
dev
=
(
struct
device
*
)
irq2dev_map
[
irq
];
struct
net_local
*
lp
=
(
struct
net_local
*
)
dev
->
priv
;
struct
plip_local
*
rcv
=
&
lp
->
rcv_data
;
struct
plip_local
*
snd
=
&
lp
->
snd_data
;
...
...
drivers/net/ppp.c
View file @
2b130d1b
...
...
@@ -550,7 +550,7 @@ ppp_open(struct tty_struct *tty)
}
/* Allocate a user-level receive buffer */
ppp
->
us_rbuff
=
kmalloc
(
RBUFSIZE
,
GFP_KERNEL
);
ppp
->
us_rbuff
=
(
unsigned
char
*
)
kmalloc
(
RBUFSIZE
,
GFP_KERNEL
);
if
(
ppp
->
us_rbuff
==
NULL
)
{
PRINTKN
(
1
,(
KERN_ERR
"ppp: no space for user receive buffer
\n
"
));
ppp_release
(
ppp
);
...
...
@@ -2013,7 +2013,7 @@ static void ppp_print_buffer(const char *name, char *buf, int count, int seg)
set_fs
(
seg
);
if
(
name
!=
(
char
*
)
NULL
)
if
(
name
!=
NULL
)
PRINTK
((
KERN_DEBUG
"ppp: %s, count = %d
\n
"
,
name
,
count
));
while
(
count
>
8
)
{
...
...
drivers/net/slip.c
View file @
2b130d1b
...
...
@@ -986,7 +986,7 @@ slip_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg)
/* Allow stty to read, but not set, the serial port */
case
TCGETS
:
case
TCGETA
:
return
n_tty_ioctl
(
tty
,
file
,
cmd
,
(
unsigned
long
)
arg
);
return
n_tty_ioctl
(
tty
,
(
struct
file
*
)
file
,
cmd
,
(
unsigned
long
)
arg
);
default:
return
-
ENOIOCTLCMD
;
...
...
drivers/scsi/hosts.c
View file @
2b130d1b
...
...
@@ -197,7 +197,7 @@ scsi_unregister(struct Scsi_Host * sh){
struct
Scsi_Host
*
scsi_register
(
Scsi_Host_Template
*
tpnt
,
int
j
){
struct
Scsi_Host
*
retval
,
*
shpnt
;
retval
=
scsi_init_malloc
(
sizeof
(
struct
Scsi_Host
)
+
j
);
retval
=
(
struct
Scsi_Host
*
)
scsi_init_malloc
(
sizeof
(
struct
Scsi_Host
)
+
j
);
retval
->
host_busy
=
0
;
if
(
j
>
0xffff
)
panic
(
"Too many extra bytes requested
\n
"
);
retval
->
extra_bytes
=
j
;
...
...
drivers/scsi/scsicam.c
View file @
2b130d1b
...
...
@@ -182,7 +182,7 @@ static int setsize(unsigned long capacity,unsigned int *cyls,unsigned int *hds,
cylinders
=
capacity
/
temp
;
/* Compute number of cylinders */
}
}
if
(
cylinders
==
0
)
rv
=
-
1
;
/* Give error if 0 cylinders */
if
(
cylinders
==
0
)
rv
=
(
unsigned
)
-
1
;
/* Give error if 0 cylinders */
*
cyls
=
(
unsigned
int
)
cylinders
;
/* Stuff return values */
*
secs
=
(
unsigned
int
)
sectors
;
...
...
drivers/sound/soundcard.c
View file @
2b130d1b
...
...
@@ -219,7 +219,7 @@ snd_set_irq_handler (int interrupt_level, void (*hndlr) (int))
{
int
retcode
;
retcode
=
request_irq
(
interrupt_level
,
&
hndlr
,
retcode
=
request_irq
(
interrupt_level
,
hndlr
,
#ifdef SND_SA_INTERRUPT
SA_INTERRUPT
,
#else
...
...
fs/buffer.c
View file @
2b130d1b
...
...
@@ -880,7 +880,7 @@ static void put_unused_buffer_head(struct buffer_head * bh)
struct
wait_queue
*
wait
;
wait
=
((
volatile
struct
buffer_head
*
)
bh
)
->
b_wait
;
memset
(
(
void
*
)
bh
,
0
,
sizeof
(
*
bh
));
memset
(
bh
,
0
,
sizeof
(
*
bh
));
((
volatile
struct
buffer_head
*
)
bh
)
->
b_wait
=
wait
;
bh
->
b_next_free
=
unused_list
;
unused_list
=
bh
;
...
...
fs/exec.c
View file @
2b130d1b
...
...
@@ -612,8 +612,7 @@ int do_execve(char * filename, char ** argv, char ** envp, struct pt_regs * regs
}
i
=
bprm
.
inode
->
i_mode
;
if
(
IS_NOSUID
(
bprm
.
inode
)
&&
(((
i
&
S_ISUID
)
&&
bprm
.
inode
->
i_uid
!=
current
->
euid
)
||
((
i
&
S_ISGID
)
&&
!
in_group_p
(
bprm
.
inode
->
i_gid
)))
&&
!
suser
())
{
euid
)
||
((
i
&
S_ISGID
)
&&
!
in_group_p
(
bprm
.
inode
->
i_gid
)))
&&
!
suser
())
{
retval
=
-
EPERM
;
goto
exec_error2
;
}
...
...
@@ -816,8 +815,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
(
current
->
mm
->
start_code
=
N_TXTADDR
(
ex
)))));
current
->
mm
->
rss
=
0
;
current
->
mm
->
mmap
=
NULL
;
current
->
suid
=
current
->
euid
=
bprm
->
e_uid
;
current
->
sgid
=
current
->
egid
=
bprm
->
e_gid
;
current
->
suid
=
current
->
euid
=
current
->
fsuid
=
bprm
->
e_uid
;
current
->
sgid
=
current
->
egid
=
current
->
fsgid
=
bprm
->
e_gid
;
if
(
N_MAGIC
(
ex
)
==
OMAGIC
)
{
do_mmap
(
NULL
,
0
,
ex
.
a_text
+
ex
.
a_data
,
PROT_READ
|
PROT_WRITE
|
PROT_EXEC
,
...
...
fs/ext/freelists.c
View file @
2b130d1b
...
...
@@ -289,8 +289,8 @@ printk("ext_free_inode: inode empty, skipping to %d\n", efi->next);
inode
->
i_count
=
1
;
inode
->
i_nlink
=
1
;
inode
->
i_dev
=
sb
->
s_dev
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
fs
gid
;
inode
->
i_dirt
=
1
;
inode
->
i_ino
=
j
;
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/ext/namei.c
View file @
2b130d1b
...
...
@@ -361,7 +361,7 @@ int ext_mknod(struct inode * dir, const char * name, int len, int mode, int rdev
iput
(
dir
);
return
-
ENOSPC
;
}
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_mode
=
mode
;
inode
->
i_op
=
NULL
;
if
(
S_ISREG
(
inode
->
i_mode
))
...
...
@@ -544,9 +544,9 @@ int ext_rmdir(struct inode * dir, const char * name, int len)
retval
=
-
EPERM
;
if
(
!
(
inode
=
iget
(
dir
->
i_sb
,
de
->
inode
)))
goto
end_rmdir
;
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_rmdir
;
if
(
inode
->
i_dev
!=
dir
->
i_dev
)
goto
end_rmdir
;
...
...
@@ -598,9 +598,9 @@ int ext_unlink(struct inode * dir, const char * name, int len)
if
(
!
(
inode
=
iget
(
dir
->
i_sb
,
de
->
inode
)))
goto
end_unlink
;
retval
=
-
EPERM
;
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_unlink
;
if
(
S_ISDIR
(
inode
->
i_mode
))
goto
end_unlink
;
...
...
@@ -791,8 +791,8 @@ static int do_ext_rename(struct inode * old_dir, const char * old_name, int old_
goto
end_rename
;
retval
=
-
EPERM
;
if
((
old_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
old_inode
->
i_uid
&&
current
->
euid
!=
old_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
old_inode
->
i_uid
&&
current
->
fsuid
!=
old_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
new_bh
=
ext_find_entry
(
new_dir
,
new_name
,
new_len
,
&
new_de
,
NULL
,
NULL
);
if
(
new_bh
)
{
...
...
@@ -812,8 +812,8 @@ static int do_ext_rename(struct inode * old_dir, const char * old_name, int old_
}
retval
=
-
EPERM
;
if
(
new_inode
&&
(
new_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
new_inode
->
i_uid
&&
current
->
euid
!=
new_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
new_inode
->
i_uid
&&
current
->
fsuid
!=
new_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
if
(
S_ISDIR
(
old_inode
->
i_mode
))
{
retval
=
-
EEXIST
;
...
...
fs/ext2/acl.c
View file @
2b130d1b
...
...
@@ -29,12 +29,12 @@ int ext2_permission (struct inode * inode, int mask)
/*
* Special case, access is always granted for root
*/
if
(
suser
())
if
(
fsuser
())
return
1
;
/*
* If no ACL, checks using the file mode
*/
else
if
(
current
->
e
uid
==
inode
->
i_uid
)
else
if
(
current
->
fs
uid
==
inode
->
i_uid
)
mode
>>=
6
;
else
if
(
in_group_p
(
inode
->
i_gid
))
mode
>>=
3
;
...
...
fs/ext2/balloc.c
View file @
2b130d1b
...
...
@@ -352,7 +352,7 @@ int ext2_new_block (struct super_block * sb, unsigned long goal,
}
lock_super
(
sb
);
es
=
sb
->
u
.
ext2_sb
.
s_es
;
if
(
es
->
s_free_blocks_count
<=
es
->
s_r_blocks_count
&&
!
suser
())
{
if
(
es
->
s_free_blocks_count
<=
es
->
s_r_blocks_count
&&
!
f
suser
())
{
unlock_super
(
sb
);
return
0
;
}
...
...
fs/ext2/ialloc.c
View file @
2b130d1b
...
...
@@ -475,7 +475,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
inode
->
i_count
=
1
;
inode
->
i_nlink
=
1
;
inode
->
i_dev
=
sb
->
s_dev
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
if
(
test_opt
(
sb
,
GRPID
))
inode
->
i_gid
=
dir
->
i_gid
;
else
if
(
dir
->
i_mode
&
S_ISGID
)
{
...
...
@@ -483,7 +483,7 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode)
if
(
S_ISDIR
(
mode
))
mode
|=
S_ISGID
;
}
else
inode
->
i_gid
=
current
->
e
gid
;
inode
->
i_gid
=
current
->
fs
gid
;
inode
->
i_dirt
=
1
;
inode
->
i_ino
=
j
;
inode
->
i_blksize
=
sb
->
s_blocksize
;
...
...
fs/ext2/ioctl.c
View file @
2b130d1b
...
...
@@ -28,7 +28,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
put_fs_long
(
inode
->
u
.
ext2_i
.
i_flags
,
(
long
*
)
arg
);
return
0
;
case
EXT2_IOC_SETFLAGS
:
if
((
current
->
euid
!=
inode
->
i_uid
)
&&
!
suser
())
if
((
current
->
fsuid
!=
inode
->
i_uid
)
&&
!
f
suser
())
return
-
EPERM
;
if
(
IS_RDONLY
(
inode
))
return
-
EROFS
;
...
...
@@ -42,7 +42,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
put_fs_long
(
inode
->
u
.
ext2_i
.
i_version
,
(
long
*
)
arg
);
return
0
;
case
EXT2_IOC_SETVERSION
:
if
((
current
->
euid
!=
inode
->
i_uid
)
&&
!
suser
())
if
((
current
->
fsuid
!=
inode
->
i_uid
)
&&
!
f
suser
())
return
-
EPERM
;
if
(
IS_RDONLY
(
inode
))
return
-
EROFS
;
...
...
fs/ext2/namei.c
View file @
2b130d1b
...
...
@@ -430,7 +430,7 @@ int ext2_mknod (struct inode * dir, const char * name, int len, int mode,
iput
(
dir
);
return
-
ENOSPC
;
}
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_mode
=
mode
;
inode
->
i_op
=
NULL
;
if
(
S_ISREG
(
inode
->
i_mode
))
...
...
@@ -630,9 +630,9 @@ int ext2_rmdir (struct inode * dir, const char * name, int len)
schedule
();
goto
repeat
;
}
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_rmdir
;
if
(
inode
==
dir
)
/* we may not delete ".", but "../dir" is ok */
goto
end_rmdir
;
...
...
@@ -711,9 +711,9 @@ int ext2_unlink (struct inode * dir, const char * name, int len)
schedule
();
goto
repeat
;
}
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_unlink
;
if
(
!
inode
->
i_nlink
)
{
ext2_warning
(
inode
->
i_sb
,
"ext2_unlink"
,
...
...
@@ -946,8 +946,8 @@ static int do_ext2_rename (struct inode * old_dir, const char * old_name,
goto
end_rename
;
retval
=
-
EPERM
;
if
((
old_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
old_inode
->
i_uid
&&
current
->
euid
!=
old_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
old_inode
->
i_uid
&&
current
->
fsuid
!=
old_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
new_bh
=
ext2_find_entry
(
new_dir
,
new_name
,
new_len
,
&
new_de
);
if
(
new_bh
)
{
...
...
@@ -977,8 +977,8 @@ static int do_ext2_rename (struct inode * old_dir, const char * old_name,
}
retval
=
-
EPERM
;
if
(
new_inode
&&
(
new_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
new_inode
->
i_uid
&&
current
->
euid
!=
new_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
new_inode
->
i_uid
&&
current
->
fsuid
!=
new_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
if
(
S_ISDIR
(
old_inode
->
i_mode
))
{
retval
=
-
ENOTDIR
;
...
...
fs/inode.c
View file @
2b130d1b
...
...
@@ -414,8 +414,8 @@ struct inode * get_pipe_inode(void)
PIPE_LOCK
(
*
inode
)
=
0
;
inode
->
i_pipe
=
1
;
inode
->
i_mode
|=
S_IFIFO
|
S_IRUSR
|
S_IWUSR
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_gid
=
current
->
e
gid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_gid
=
current
->
fs
gid
;
inode
->
i_atime
=
inode
->
i_mtime
=
inode
->
i_ctime
=
CURRENT_TIME
;
return
inode
;
}
...
...
fs/minix/bitmap.c
View file @
2b130d1b
...
...
@@ -213,8 +213,8 @@ struct inode * minix_new_inode(const struct inode * dir)
inode
->
i_count
=
1
;
inode
->
i_nlink
=
1
;
inode
->
i_dev
=
sb
->
s_dev
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
fs
gid
;
inode
->
i_dirt
=
1
;
inode
->
i_ino
=
j
;
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/minix/namei.c
View file @
2b130d1b
...
...
@@ -265,7 +265,7 @@ int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rd
iput
(
dir
);
return
-
ENOSPC
;
}
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_mode
=
mode
;
inode
->
i_op
=
NULL
;
if
(
S_ISREG
(
inode
->
i_mode
))
...
...
@@ -443,9 +443,9 @@ int minix_rmdir(struct inode * dir, const char * name, int len)
retval
=
-
EPERM
;
if
(
!
(
inode
=
iget
(
dir
->
i_sb
,
de
->
inode
)))
goto
end_rmdir
;
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_rmdir
;
if
(
inode
->
i_dev
!=
dir
->
i_dev
)
goto
end_rmdir
;
...
...
@@ -509,9 +509,9 @@ int minix_unlink(struct inode * dir, const char * name, int len)
schedule
();
goto
repeat
;
}
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_unlink
;
if
(
de
->
inode
!=
inode
->
i_ino
)
{
retval
=
-
ENOENT
;
...
...
@@ -700,8 +700,8 @@ static int do_minix_rename(struct inode * old_dir, const char * old_name, int ol
goto
end_rename
;
retval
=
-
EPERM
;
if
((
old_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
old_inode
->
i_uid
&&
current
->
euid
!=
old_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
old_inode
->
i_uid
&&
current
->
fsuid
!=
old_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
new_bh
=
minix_find_entry
(
new_dir
,
new_name
,
new_len
,
&
new_de
);
if
(
new_bh
)
{
...
...
@@ -731,8 +731,8 @@ static int do_minix_rename(struct inode * old_dir, const char * old_name, int ol
}
retval
=
-
EPERM
;
if
(
new_inode
&&
(
new_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
new_inode
->
i_uid
&&
current
->
euid
!=
new_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
new_inode
->
i_uid
&&
current
->
fsuid
!=
new_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
if
(
S_ISDIR
(
old_inode
->
i_mode
))
{
retval
=
-
ENOTDIR
;
...
...
fs/namei.c
View file @
2b130d1b
...
...
@@ -68,8 +68,9 @@ void putname(char * name)
* permission()
*
* is used to check for read/write/execute permissions on a file.
* I don't know if we should look at just the euid or both euid and
* uid, but that should be easily changed.
* We use "fsuid" for this, letting us set arbitrary permissions
* permissions for filesystem access without changing the "normal"
* uids which are used for other things..
*/
int
permission
(
struct
inode
*
inode
,
int
mask
)
{
...
...
@@ -77,11 +78,11 @@ int permission(struct inode * inode,int mask)
if
(
inode
->
i_op
&&
inode
->
i_op
->
permission
)
return
inode
->
i_op
->
permission
(
inode
,
mask
);
else
if
(
current
->
e
uid
==
inode
->
i_uid
)
else
if
(
current
->
fs
uid
==
inode
->
i_uid
)
mode
>>=
6
;
else
if
(
in_group_p
(
inode
->
i_gid
))
mode
>>=
3
;
if
(((
mode
&
mask
&
0007
)
==
mask
)
||
suser
())
if
(((
mode
&
mask
&
0007
)
==
mask
)
||
f
suser
())
return
1
;
return
0
;
}
...
...
@@ -418,7 +419,7 @@ asmlinkage int sys_mknod(const char * filename, int mode, dev_t dev)
int
error
;
char
*
tmp
;
if
(
S_ISDIR
(
mode
)
||
(
!
S_ISFIFO
(
mode
)
&&
!
suser
()))
if
(
S_ISDIR
(
mode
)
||
(
!
S_ISFIFO
(
mode
)
&&
!
f
suser
()))
return
-
EPERM
;
switch
(
mode
&
S_IFMT
)
{
case
0
:
...
...
fs/nfs/proc.c
View file @
2b130d1b
...
...
@@ -225,7 +225,7 @@ int nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply getattr
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -260,7 +260,7 @@ int nfs_proc_setattr(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply setattr
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -300,7 +300,7 @@ int nfs_proc_lookup(struct nfs_server *server, struct nfs_fh *dir, const char *n
PRINTK
(
"NFS reply lookup
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -338,7 +338,7 @@ int nfs_proc_readlink(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply readlink %s
\n
"
,
res
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -381,7 +381,7 @@ int nfs_proc_read(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply read %d
\n
"
,
len
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -419,7 +419,7 @@ int nfs_proc_write(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply write
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -457,7 +457,7 @@ int nfs_proc_create(struct nfs_server *server, struct nfs_fh *dir,
PRINTK
(
"NFS reply create
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -490,7 +490,7 @@ int nfs_proc_remove(struct nfs_server *server, struct nfs_fh *dir, const char *n
PRINTK
(
"NFS reply remove
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -527,7 +527,7 @@ int nfs_proc_rename(struct nfs_server *server,
PRINTK
(
"NFS reply rename
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -562,7 +562,7 @@ int nfs_proc_link(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply link
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -598,7 +598,7 @@ int nfs_proc_symlink(struct nfs_server *server, struct nfs_fh *dir,
PRINTK
(
"NFS reply symlink
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -636,7 +636,7 @@ int nfs_proc_mkdir(struct nfs_server *server, struct nfs_fh *dir,
PRINTK
(
"NFS reply mkdir
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -669,7 +669,7 @@ int nfs_proc_rmdir(struct nfs_server *server, struct nfs_fh *dir, const char *na
PRINTK
(
"NFS reply rmdir
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -723,7 +723,7 @@ int nfs_proc_readdir(struct nfs_server *server, struct nfs_fh *fhandle,
}
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -757,7 +757,7 @@ int nfs_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
PRINTK
(
"NFS reply statfs
\n
"
);
}
else
{
if
(
!
ruid
&&
current
->
e
uid
==
0
&&
current
->
uid
!=
0
)
{
if
(
!
ruid
&&
current
->
fs
uid
==
0
&&
current
->
uid
!=
0
)
{
ruid
=
1
;
goto
retry
;
}
...
...
@@ -792,7 +792,7 @@ static int *nfs_rpc_header(int *p, int procedure, int ruid)
p1
=
p
++
;
*
p
++
=
htonl
(
CURRENT_TIME
);
/* traditional, could be anything */
p
=
xdr_encode_string
(
p
,
(
char
*
)
sys
);
*
p
++
=
htonl
(
ruid
?
current
->
uid
:
current
->
e
uid
);
*
p
++
=
htonl
(
ruid
?
current
->
uid
:
current
->
fs
uid
);
*
p
++
=
htonl
(
current
->
egid
);
p2
=
p
++
;
for
(
i
=
0
;
i
<
16
&&
i
<
NGROUPS
&&
current
->
groups
[
i
]
!=
NOGROUP
;
i
++
)
...
...
fs/open.c
View file @
2b130d1b
...
...
@@ -128,7 +128,7 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
return
-
EROFS
;
}
if
(
times
)
{
if
((
current
->
euid
!=
inode
->
i_uid
)
&&
!
suser
())
{
if
((
current
->
fsuid
!=
inode
->
i_uid
)
&&
!
f
suser
())
{
iput
(
inode
);
return
-
EPERM
;
}
...
...
@@ -136,7 +136,7 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
modtime
=
get_fs_long
((
unsigned
long
*
)
&
times
->
modtime
);
inode
->
i_ctime
=
CURRENT_TIME
;
}
else
{
if
((
current
->
e
uid
!=
inode
->
i_uid
)
&&
if
((
current
->
fs
uid
!=
inode
->
i_uid
)
&&
!
permission
(
inode
,
MAY_WRITE
))
{
iput
(
inode
);
return
-
EACCES
;
...
...
@@ -152,41 +152,30 @@ asmlinkage int sys_utime(char * filename, struct utimbuf * times)
}
/*
*
XXX we should use the real ids for checking _all_ components of the
*
path. Now we only use them for the final component of the path.
*
access() needs to use the real uid/gid, not the effective uid/gid.
*
We do this by temporarily setting fsuid/fsgid to the wanted values
*/
asmlinkage
int
sys_access
(
const
char
*
filename
,
int
mode
)
asmlinkage
int
sys_access
(
const
char
*
filename
,
int
mode
)
{
struct
inode
*
inode
;
int
res
,
i_mode
;
int
old_fsuid
,
old_fsgid
;
int
res
;
if
(
mode
!=
(
mode
&
S_IRWXO
))
/* where's F_OK, X_OK, W_OK, R_OK? */
return
-
EINVAL
;
old_fsuid
=
current
->
fsuid
;
old_fsgid
=
current
->
fsgid
;
current
->
fsuid
=
current
->
uid
;
current
->
fsgid
=
current
->
gid
;
res
=
namei
(
filename
,
&
inode
);
if
(
res
)
return
res
;
i_mode
=
inode
->
i_mode
;
res
=
i_mode
&
S_IRWXUGO
;
if
(
current
->
uid
==
inode
->
i_uid
)
res
>>=
6
;
/* needs cleaning? */
else
if
(
in_group_p
(
inode
->
i_gid
))
res
>>=
3
;
/* needs cleaning? */
iput
(
inode
);
if
((
res
&
mode
)
==
mode
)
return
0
;
/*
* XXX we are doing this test last because we really should be
* swapping the effective with the real user id (temporarily),
* and then calling suser() routine. If we do call the
* suser() routine, it needs to be called last.
*
* XXX nope. suser() is inappropriate and swapping the ids while
* decomposing the path would be racy.
*/
if
((
!
current
->
uid
)
&&
(
S_ISDIR
(
i_mode
)
||
!
(
mode
&
S_IXOTH
)
||
(
i_mode
&
S_IXUGO
)))
return
0
;
return
-
EACCES
;
if
(
!
res
)
{
if
(
!
permission
(
inode
,
mode
))
res
=
-
EACCES
;
iput
(
inode
);
}
current
->
fsuid
=
old_fsuid
;
current
->
fsgid
=
old_fsgid
;
return
res
;
}
asmlinkage
int
sys_chdir
(
const
char
*
filename
)
...
...
@@ -241,7 +230,7 @@ asmlinkage int sys_chroot(const char * filename)
iput
(
inode
);
return
-
ENOTDIR
;
}
if
(
!
suser
())
{
if
(
!
f
suser
())
{
iput
(
inode
);
return
-
EPERM
;
}
...
...
@@ -259,14 +248,14 @@ asmlinkage int sys_fchmod(unsigned int fd, mode_t mode)
return
-
EBADF
;
if
(
!
(
inode
=
file
->
f_inode
))
return
-
ENOENT
;
if
((
current
->
euid
!=
inode
->
i_uid
)
&&
!
suser
())
if
((
current
->
fsuid
!=
inode
->
i_uid
)
&&
!
f
suser
())
return
-
EPERM
;
if
(
IS_RDONLY
(
inode
))
return
-
EROFS
;
if
(
mode
==
(
mode_t
)
-
1
)
mode
=
inode
->
i_mode
;
inode
->
i_mode
=
(
mode
&
S_IALLUGO
)
|
(
inode
->
i_mode
&
~
S_IALLUGO
);
if
(
!
suser
()
&&
!
in_group_p
(
inode
->
i_gid
))
if
(
!
f
suser
()
&&
!
in_group_p
(
inode
->
i_gid
))
inode
->
i_mode
&=
~
S_ISGID
;
inode
->
i_ctime
=
CURRENT_TIME
;
inode
->
i_dirt
=
1
;
...
...
@@ -281,7 +270,7 @@ asmlinkage int sys_chmod(const char * filename, mode_t mode)
error
=
namei
(
filename
,
&
inode
);
if
(
error
)
return
error
;
if
((
current
->
euid
!=
inode
->
i_uid
)
&&
!
suser
())
{
if
((
current
->
fsuid
!=
inode
->
i_uid
)
&&
!
f
suser
())
{
iput
(
inode
);
return
-
EPERM
;
}
...
...
@@ -292,7 +281,7 @@ asmlinkage int sys_chmod(const char * filename, mode_t mode)
if
(
mode
==
(
mode_t
)
-
1
)
mode
=
inode
->
i_mode
;
inode
->
i_mode
=
(
mode
&
S_IALLUGO
)
|
(
inode
->
i_mode
&
~
S_IALLUGO
);
if
(
!
suser
()
&&
!
in_group_p
(
inode
->
i_gid
))
if
(
!
f
suser
()
&&
!
in_group_p
(
inode
->
i_gid
))
inode
->
i_mode
&=
~
S_ISGID
;
inode
->
i_ctime
=
CURRENT_TIME
;
inode
->
i_dirt
=
1
;
...
...
@@ -316,9 +305,9 @@ asmlinkage int sys_fchown(unsigned int fd, uid_t user, gid_t group)
user
=
inode
->
i_uid
;
if
(
group
==
(
gid_t
)
-
1
)
group
=
inode
->
i_gid
;
if
((
current
->
e
uid
==
inode
->
i_uid
&&
user
==
inode
->
i_uid
&&
if
((
current
->
fs
uid
==
inode
->
i_uid
&&
user
==
inode
->
i_uid
&&
(
in_group_p
(
group
)
||
group
==
inode
->
i_gid
))
||
suser
())
{
f
suser
())
{
inode
->
i_uid
=
user
;
inode
->
i_gid
=
group
;
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
@@ -344,9 +333,9 @@ asmlinkage int sys_chown(const char * filename, uid_t user, gid_t group)
user
=
inode
->
i_uid
;
if
(
group
==
(
gid_t
)
-
1
)
group
=
inode
->
i_gid
;
if
((
current
->
e
uid
==
inode
->
i_uid
&&
user
==
inode
->
i_uid
&&
if
((
current
->
fs
uid
==
inode
->
i_uid
&&
user
==
inode
->
i_uid
&&
(
in_group_p
(
group
)
||
group
==
inode
->
i_gid
))
||
suser
())
{
f
suser
())
{
inode
->
i_uid
=
user
;
inode
->
i_gid
=
group
;
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/sysv/ialloc.c
View file @
2b130d1b
...
...
@@ -135,8 +135,8 @@ struct inode * sysv_new_inode(const struct inode * dir)
inode
->
i_count
=
1
;
inode
->
i_nlink
=
1
;
inode
->
i_dev
=
sb
->
s_dev
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
fs
gid
;
inode
->
i_dirt
=
1
;
inode
->
i_ino
=
ino
;
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/sysv/namei.c
View file @
2b130d1b
...
...
@@ -265,7 +265,7 @@ int sysv_mknod(struct inode * dir, const char * name, int len, int mode, int rde
iput
(
dir
);
return
-
ENOSPC
;
}
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_mode
=
mode
;
inode
->
i_op
=
NULL
;
if
(
S_ISREG
(
inode
->
i_mode
))
...
...
@@ -447,9 +447,9 @@ int sysv_rmdir(struct inode * dir, const char * name, int len)
retval
=
-
EPERM
;
if
(
!
(
inode
=
iget
(
dir
->
i_sb
,
de
->
inode
)))
goto
end_rmdir
;
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_rmdir
;
if
(
inode
->
i_dev
!=
dir
->
i_dev
)
goto
end_rmdir
;
...
...
@@ -513,9 +513,9 @@ int sysv_unlink(struct inode * dir, const char * name, int len)
schedule
();
goto
repeat
;
}
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_unlink
;
if
(
de
->
inode
!=
inode
->
i_ino
)
{
retval
=
-
ENOENT
;
...
...
@@ -708,8 +708,8 @@ static int do_sysv_rename(struct inode * old_dir, const char * old_name, int old
goto
end_rename
;
retval
=
-
EPERM
;
if
((
old_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
old_inode
->
i_uid
&&
current
->
euid
!=
old_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
old_inode
->
i_uid
&&
current
->
fsuid
!=
old_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
new_bh
=
sysv_find_entry
(
new_dir
,
new_name
,
new_len
,
&
new_de
);
if
(
new_bh
)
{
...
...
@@ -739,8 +739,8 @@ static int do_sysv_rename(struct inode * old_dir, const char * old_name, int old
}
retval
=
-
EPERM
;
if
(
new_inode
&&
(
new_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
new_inode
->
i_uid
&&
current
->
euid
!=
new_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
new_inode
->
i_uid
&&
current
->
fsuid
!=
new_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
if
(
S_ISDIR
(
old_inode
->
i_mode
))
{
retval
=
-
ENOTDIR
;
...
...
fs/umsdos/namei.c
View file @
2b130d1b
...
...
@@ -216,9 +216,9 @@ static int umsdos_create_any (
info
.
entry
.
mode
=
mode
;
info
.
entry
.
rdev
=
rdev
;
info
.
entry
.
flags
=
flags
;
info
.
entry
.
uid
=
current
->
e
uid
;
info
.
entry
.
uid
=
current
->
fs
uid
;
info
.
entry
.
gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
?
dir
->
i_gid
:
current
->
fs
gid
;
info
.
entry
.
ctime
=
info
.
entry
.
atime
=
info
.
entry
.
mtime
=
CURRENT_TIME
;
info
.
entry
.
nlink
=
1
;
...
...
@@ -659,9 +659,9 @@ int UMSDOS_mkdir(
if
(
ret
==
0
){
info
.
entry
.
mode
=
mode
|
S_IFDIR
;
info
.
entry
.
rdev
=
0
;
info
.
entry
.
uid
=
current
->
e
uid
;
info
.
entry
.
uid
=
current
->
fs
uid
;
info
.
entry
.
gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
?
dir
->
i_gid
:
current
->
fs
gid
;
info
.
entry
.
ctime
=
info
.
entry
.
atime
=
info
.
entry
.
mtime
=
CURRENT_TIME
;
info
.
entry
.
flags
=
0
;
...
...
fs/xiafs/bitmap.c
View file @
2b130d1b
...
...
@@ -329,8 +329,8 @@ struct inode * xiafs_new_inode(struct inode * dir)
inode
->
i_count
=
1
;
inode
->
i_nlink
=
1
;
inode
->
i_dev
=
sb
->
s_dev
;
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
e
gid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_gid
=
(
dir
->
i_mode
&
S_ISGID
)
?
dir
->
i_gid
:
current
->
fs
gid
;
inode
->
i_dirt
=
1
;
inode
->
i_ino
=
tmp
;
inode
->
i_mtime
=
inode
->
i_atime
=
inode
->
i_ctime
=
CURRENT_TIME
;
...
...
fs/xiafs/namei.c
View file @
2b130d1b
...
...
@@ -294,7 +294,7 @@ int xiafs_mknod(struct inode *dir, const char *name, int len, int mode, int rdev
iput
(
dir
);
return
-
ENOSPC
;
}
inode
->
i_uid
=
current
->
e
uid
;
inode
->
i_uid
=
current
->
fs
uid
;
inode
->
i_mode
=
mode
;
inode
->
i_op
=
NULL
;
if
(
S_ISREG
(
inode
->
i_mode
))
...
...
@@ -496,9 +496,9 @@ int xiafs_rmdir(struct inode * dir, const char * name, int len)
retval
=
-
EPERM
;
if
(
!
(
inode
=
iget
(
dir
->
i_sb
,
de
->
d_ino
)))
goto
end_rmdir
;
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_rmdir
;
if
(
inode
->
i_dev
!=
dir
->
i_dev
)
goto
end_rmdir
;
...
...
@@ -558,9 +558,9 @@ int xiafs_unlink(struct inode * dir, const char * name, int len)
schedule
();
goto
repeat
;
}
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
suser
()
&&
current
->
e
uid
!=
inode
->
i_uid
&&
current
->
e
uid
!=
dir
->
i_uid
)
if
((
dir
->
i_mode
&
S_ISVTX
)
&&
!
f
suser
()
&&
current
->
fs
uid
!=
inode
->
i_uid
&&
current
->
fs
uid
!=
dir
->
i_uid
)
goto
end_unlink
;
if
(
!
inode
->
i_nlink
)
{
printk
(
"XIA-FS: Deleting nonexistent file (%s %d)
\n
"
,
WHERE_ERR
);
...
...
@@ -730,8 +730,8 @@ static int do_xiafs_rename(struct inode * old_dir, const char * old_name,
goto
end_rename
;
retval
=
-
EPERM
;
if
((
old_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
old_inode
->
i_uid
&&
current
->
euid
!=
old_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
old_inode
->
i_uid
&&
current
->
fsuid
!=
old_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
new_bh
=
xiafs_find_entry
(
new_dir
,
new_name
,
new_len
,
&
new_de
,
NULL
);
if
(
new_bh
)
{
...
...
@@ -751,8 +751,8 @@ static int do_xiafs_rename(struct inode * old_dir, const char * old_name,
}
retval
=
-
EPERM
;
if
(
new_inode
&&
(
new_dir
->
i_mode
&
S_ISVTX
)
&&
current
->
e
uid
!=
new_inode
->
i_uid
&&
current
->
euid
!=
new_dir
->
i_uid
&&
!
suser
())
current
->
fs
uid
!=
new_inode
->
i_uid
&&
current
->
fsuid
!=
new_dir
->
i_uid
&&
!
f
suser
())
goto
end_rename
;
if
(
S_ISDIR
(
old_inode
->
i_mode
))
{
retval
=
-
EEXIST
;
...
...
include/asm/segment.h
View file @
2b130d1b
...
...
@@ -149,7 +149,7 @@ static inline void __constant_memcpy_fromfs(void * to, const void * from, unsign
return
;
case
3
:
*
(
short
*
)
to
=
get_user_word
((
const
short
*
)
from
);
*
(
char
*
)
to
=
get_user_byte
(
2
+
(
const
char
*
)
from
);
*
(
(
char
*
)
to
+
2
)
=
get_user_byte
(
2
+
(
const
char
*
)
from
);
return
;
case
4
:
*
(
int
*
)
to
=
get_user_long
((
const
int
*
)
from
);
...
...
include/linux/kernel.h
View file @
2b130d1b
...
...
@@ -60,8 +60,13 @@ asmlinkage int printk(const char * fmt, ...)
* BSD-style accounting where the process is flagged if it uses root
* privs). The implication of this is that you should do normal
* permissions checks first, and check suser() last.
*
* "suser()" checks against the effective user id, while "fsuser()"
* is used for file permission checking and checks against the fsuid..
*/
#define suser() (current->euid == 0)
#define fsuser() (current->fsuid == 0)
extern
int
splx
(
int
new_ipl
);
#endif
/* __KERNEL__ */
...
...
include/linux/sched.h
View file @
2b130d1b
...
...
@@ -270,8 +270,8 @@ struct task_struct {
*/
struct
task_struct
*
p_opptr
,
*
p_pptr
,
*
p_cptr
,
*
p_ysptr
,
*
p_osptr
;
struct
wait_queue
*
wait_chldexit
;
/* for wait4() */
unsigned
short
uid
,
euid
,
suid
;
unsigned
short
gid
,
egid
,
sgid
;
unsigned
short
uid
,
euid
,
suid
,
fsuid
;
unsigned
short
gid
,
egid
,
sgid
,
fsgid
;
unsigned
long
timeout
;
unsigned
long
it_real_value
,
it_prof_value
,
it_virt_value
;
unsigned
long
it_real_incr
,
it_prof_incr
,
it_virt_incr
;
...
...
@@ -332,7 +332,7 @@ struct task_struct {
/* pid etc.. */
0,0,0,0, \
/* suppl grps*/
{NOGROUP,}, \
/* proc links*/
&init_task,&init_task,NULL,NULL,NULL,NULL, \
/* uid etc */
0,0,0,0,0,0, \
/* uid etc */
0,0,0,0,0,0,
0,0,
\
/* timeout */
0,0,0,0,0,0,0,0,0,0,0,0, \
/* rlimits */
{ {LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
{LONG_MAX, LONG_MAX}, {LONG_MAX, LONG_MAX}, \
...
...
include/linux/skbuff.h
View file @
2b130d1b
...
...
@@ -46,7 +46,7 @@ struct sk_buff {
volatile
unsigned
long
when
;
/* used to compute rtt's */
struct
timeval
stamp
;
struct
device
*
dev
;
void
*
mem_addr
;
struct
sk_buff
*
mem_addr
;
union
{
struct
tcphdr
*
th
;
struct
ethhdr
*
eth
;
...
...
include/linux/string.h
View file @
2b130d1b
...
...
@@ -11,8 +11,12 @@
extern
"C"
{
#endif
#ifdef i386
#include <asm/string.h>
/* inline functions for i386.. */
#else
extern
char
*
strcpy
(
char
*
,
const
char
*
);
extern
char
*
strncpy
(
char
*
,
const
char
*
,
size_t
);
extern
char
*
strcat
(
char
*
,
const
char
*
);
...
...
@@ -33,6 +37,8 @@ extern int memcmp(const void *, const void *, size_t);
extern
void
*
memchr
(
const
void
*
,
char
,
size_t
);
extern
void
*
memset
(
void
*
,
char
,
size_t
);
#endif
#ifdef __cplusplus
}
#endif
...
...
include/linux/unistd.h
View file @
2b130d1b
...
...
@@ -144,6 +144,8 @@
#define __NR_sysfs 135
#define __NR_personality 136
#define __NR_afs_syscall 137
/* Syscall for Andrew File System */
#define __NR_setfsuid 138
#define __NR_setfsgid 139
extern
int
errno
;
...
...
kernel/sys.c
View file @
2b130d1b
...
...
@@ -233,6 +233,7 @@ asmlinkage int sys_setregid(gid_t rgid, gid_t egid)
if
(
rgid
!=
(
gid_t
)
-
1
||
(
egid
!=
(
gid_t
)
-
1
&&
egid
!=
old_rgid
))
current
->
sgid
=
current
->
egid
;
current
->
fsgid
=
current
->
egid
;
return
0
;
}
...
...
@@ -242,9 +243,9 @@ asmlinkage int sys_setregid(gid_t rgid, gid_t egid)
asmlinkage
int
sys_setgid
(
gid_t
gid
)
{
if
(
suser
())
current
->
gid
=
current
->
egid
=
current
->
sgid
=
gid
;
current
->
gid
=
current
->
egid
=
current
->
sgid
=
current
->
fsgid
=
gid
;
else
if
((
gid
==
current
->
gid
)
||
(
gid
==
current
->
sgid
))
current
->
egid
=
gid
;
current
->
egid
=
current
->
fsgid
=
gid
;
else
return
-
EPERM
;
return
0
;
...
...
@@ -321,6 +322,7 @@ asmlinkage int sys_setreuid(uid_t ruid, uid_t euid)
if
(
ruid
!=
(
uid_t
)
-
1
||
(
euid
!=
(
uid_t
)
-
1
&&
euid
!=
old_ruid
))
current
->
suid
=
current
->
euid
;
current
->
fsuid
=
euid
;
return
0
;
}
...
...
@@ -338,14 +340,43 @@ asmlinkage int sys_setreuid(uid_t ruid, uid_t euid)
asmlinkage
int
sys_setuid
(
uid_t
uid
)
{
if
(
suser
())
current
->
uid
=
current
->
euid
=
current
->
suid
=
uid
;
current
->
uid
=
current
->
euid
=
current
->
suid
=
current
->
fsuid
=
uid
;
else
if
((
uid
==
current
->
uid
)
||
(
uid
==
current
->
suid
))
current
->
euid
=
uid
;
current
->
fsuid
=
current
->
euid
=
uid
;
else
return
-
EPERM
;
return
(
0
);
}
/*
* "setfsuid()" sets the fsuid - the uid used for filesystem checks. This
* is used for "access()" and for the NFS deamon (letting nfsd stay at
* whatever uid it wants to). It normally shadows "euid", except when
* explicitly set by setfsuid() or for access..
*/
asmlinkage
int
sys_setfsuid
(
uid_t
uid
)
{
int
old_fsuid
=
current
->
fsuid
;
if
(
uid
==
current
->
uid
||
uid
==
current
->
euid
||
uid
==
current
->
suid
||
uid
==
current
->
fsuid
||
suser
())
current
->
fsuid
=
uid
;
return
old_fsuid
;
}
/*
* Samma på svenska..
*/
asmlinkage
int
sys_setfsgid
(
gid_t
gid
)
{
int
old_fsgid
=
current
->
fsgid
;
if
(
gid
==
current
->
gid
||
gid
==
current
->
egid
||
gid
==
current
->
sgid
||
gid
==
current
->
fsgid
||
suser
())
current
->
fsgid
=
gid
;
return
old_fsgid
;
}
asmlinkage
int
sys_times
(
struct
tms
*
tbuf
)
{
if
(
tbuf
)
{
...
...
@@ -542,7 +573,7 @@ int in_group_p(gid_t grp)
{
int
i
;
if
(
grp
==
current
->
e
gid
)
if
(
grp
==
current
->
fs
gid
)
return
1
;
for
(
i
=
0
;
i
<
NGROUPS
;
i
++
)
{
...
...
kernel/sys_call.S
View file @
2b130d1b
...
...
@@ -538,5 +538,7 @@ _sys_call_table:
.
long
_sys_sysfs
/*
135
*/
.
long
_sys_personality
.
long
0
/*
for
afs_syscall
*/
.
long
_sys_setfsuid
.
long
_sys_setfsgid
.
space
(
NR_syscalls
-
137
)*
4
mm/mmap.c
View file @
2b130d1b
...
...
@@ -121,7 +121,8 @@ int do_mmap(struct file * file, unsigned long addr, unsigned long len,
else
mask
|=
PAGE_SHARED
;
vma
=
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
vma
=
(
struct
vm_area_struct
*
)
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
if
(
!
vma
)
return
-
ENOMEM
;
...
...
mm/mprotect.c
View file @
2b130d1b
...
...
@@ -63,20 +63,20 @@ static inline int mprotect_fixup_start(struct vm_area_struct * vma,
unsigned
long
end
,
int
newflags
,
int
prot
)
{
struct
vm_area_struct
*
n
ew
;
struct
vm_area_struct
*
n
;
n
ew
=
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
if
(
!
n
ew
)
n
=
(
struct
vm_area_struct
*
)
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
if
(
!
n
)
return
-
ENOMEM
;
*
n
ew
=
*
vma
;
*
n
=
*
vma
;
vma
->
vm_start
=
end
;
n
ew
->
vm_end
=
end
;
vma
->
vm_offset
+=
vma
->
vm_start
-
n
ew
->
vm_start
;
n
ew
->
vm_flags
=
newflags
;
n
ew
->
vm_page_prot
=
prot
;
if
(
n
ew
->
vm_inode
)
n
ew
->
vm_inode
->
i_count
++
;
insert_vm_struct
(
current
,
n
ew
);
n
->
vm_end
=
end
;
vma
->
vm_offset
+=
vma
->
vm_start
-
n
->
vm_start
;
n
->
vm_flags
=
newflags
;
n
->
vm_page_prot
=
prot
;
if
(
n
->
vm_inode
)
n
->
vm_inode
->
i_count
++
;
insert_vm_struct
(
current
,
n
);
merge_segments
(
current
->
mm
->
mmap
);
return
0
;
}
...
...
@@ -85,20 +85,20 @@ static inline int mprotect_fixup_end(struct vm_area_struct * vma,
unsigned
long
start
,
int
newflags
,
int
prot
)
{
struct
vm_area_struct
*
n
ew
;
struct
vm_area_struct
*
n
;
n
ew
=
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
if
(
!
n
ew
)
n
=
(
struct
vm_area_struct
*
)
kmalloc
(
sizeof
(
struct
vm_area_struct
),
GFP_KERNEL
);
if
(
!
n
)
return
-
ENOMEM
;
*
n
ew
=
*
vma
;
*
n
=
*
vma
;
vma
->
vm_end
=
start
;
n
ew
->
vm_start
=
start
;
n
ew
->
vm_offset
+=
new
->
vm_start
-
vma
->
vm_start
;
n
ew
->
vm_flags
=
newflags
;
n
ew
->
vm_page_prot
=
prot
;
if
(
n
ew
->
vm_inode
)
n
ew
->
vm_inode
->
i_count
++
;
insert_vm_struct
(
current
,
n
ew
);
n
->
vm_start
=
start
;
n
->
vm_offset
+=
n
->
vm_start
-
vma
->
vm_start
;
n
->
vm_flags
=
newflags
;
n
->
vm_page_prot
=
prot
;
if
(
n
->
vm_inode
)
n
->
vm_inode
->
i_count
++
;
insert_vm_struct
(
current
,
n
);
merge_segments
(
current
->
mm
->
mmap
);
return
0
;
}
...
...
net/inet/eth.c
View file @
2b130d1b
...
...
@@ -166,7 +166,7 @@ int eth_rebuild_header(void *buff, struct device *dev, unsigned long dst,
unsigned
short
eth_type_trans
(
struct
sk_buff
*
skb
,
struct
device
*
dev
)
{
struct
ethhdr
*
eth
=
(
struct
ethhdr
*
)
skb
->
data
;
char
*
rawp
;
unsigned
char
*
rawp
;
if
(
*
eth
->
h_dest
&
1
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment