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
nexedi
linux
Commits
66ebd50b
Commit
66ebd50b
authored
May 18, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://kernel-acme.bkbits.net:8080/intermezzo-copy_tofrom_user-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
10e3215f
280067b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
166 deletions
+129
-166
fs/intermezzo/ext_attr.c
fs/intermezzo/ext_attr.c
+2
-3
fs/intermezzo/kml.c
fs/intermezzo/kml.c
+18
-22
fs/intermezzo/psdev.c
fs/intermezzo/psdev.c
+109
-141
No files found.
fs/intermezzo/ext_attr.c
View file @
66ebd50b
...
...
@@ -105,9 +105,8 @@ int presto_set_ext_attr(struct inode *inode,
printk
(
"InterMezzo: out of memory!!!
\n
"
);
return
-
ENOMEM
;
}
error
=
copy_from_user
(
buf
,
buffer
,
buffer_len
);
if
(
error
)
return
error
;
if
(
copy_from_user
(
buf
,
buffer
,
buffer_len
))
return
-
EFAULT
;
}
else
buf
=
buffer
;
}
else
...
...
fs/intermezzo/kml.c
View file @
66ebd50b
...
...
@@ -31,10 +31,9 @@ int begin_kml_reint (struct file *file, unsigned long arg)
ENTRY
;
/* allocate buffer & copy it to kernel space */
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
if
(
input
.
reclen
>
kml_fsdata
->
kml_maxsize
)
...
...
@@ -45,11 +44,10 @@ int begin_kml_reint (struct file *file, unsigned long arg)
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
))
{
PRESTO_FREE
(
path
,
input
.
namelen
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
namelen
]
=
'\0'
;
fset
=
kml_getfset
(
path
);
...
...
@@ -57,10 +55,9 @@ int begin_kml_reint (struct file *file, unsigned long arg)
kml_fsdata
=
FSET_GET_KMLDATA
(
fset
);
/* read the buf from user memory here */
error
=
copy_from_user
(
kml_fsdata
->
kml_buf
,
input
.
recbuf
,
input
.
reclen
);
if
(
error
)
{
if
(
copy_from_user
(
kml_fsdata
->
kml_buf
,
input
.
recbuf
,
input
.
reclen
))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
kml_fsdata
->
kml_len
=
input
.
reclen
;
...
...
@@ -94,21 +91,19 @@ int do_kml_reint (struct file *file, unsigned long arg)
struct
presto_file_set
*
fset
;
ENTRY
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
namelen
+
1
);
if
(
!
path
)
{
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
))
{
PRESTO_FREE
(
path
,
input
.
namelen
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
namelen
]
=
'\0'
;
fset
=
kml_getfset
(
path
);
...
...
@@ -138,7 +133,8 @@ int do_kml_reint (struct file *file, unsigned long arg)
strlen
(
close
->
path
)
+
1
,
input
.
pathlen
);
error
=
-
ENOMEM
;
}
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
));
if
(
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
)))
return
-
EFAULT
;
}
return
error
;
}
...
...
@@ -161,10 +157,9 @@ int end_kml_reint (struct file *file, unsigned long arg)
char
*
path
;
ENTRY
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
namelen
+
1
);
...
...
@@ -172,11 +167,11 @@ int end_kml_reint (struct file *file, unsigned long arg)
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
);
if
(
copy_from_user
(
path
,
input
.
volname
,
input
.
namelen
))
{
if
(
error
)
{
PRESTO_FREE
(
path
,
input
.
namelen
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
namelen
]
=
'\0'
;
fset
=
kml_getfset
(
path
);
...
...
@@ -193,7 +188,8 @@ int end_kml_reint (struct file *file, unsigned long arg)
#if 0
input.newpos = kml_upc->newpos;
input.count = kml_upc->count;
copy_to_user((char *)arg, &input, sizeof (input));
if (copy_to_user((char *)arg, &input, sizeof (input)))
return -EFAULT;
#endif
return
error
;
}
fs/intermezzo/psdev.c
View file @
66ebd50b
...
...
@@ -149,9 +149,8 @@ static ssize_t presto_psdev_write(struct file *file, const char *buf,
return
-
EINVAL
;
}
error
=
copy_from_user
(
&
hdr
,
buf
,
sizeof
(
hdr
));
if
(
error
)
return
error
;
if
(
copy_from_user
(
&
hdr
,
buf
,
sizeof
(
hdr
)))
return
-
EFAULT
;
CDEBUG
(
D_PSDEV
,
"(process,opc,uniq)=(%d,%d,%d)
\n
"
,
current
->
pid
,
hdr
.
opcode
,
hdr
.
unique
);
...
...
@@ -183,9 +182,8 @@ static ssize_t presto_psdev_write(struct file *file, const char *buf,
req
->
rq_bufsize
,
count
,
hdr
.
opcode
,
hdr
.
unique
);
count
=
req
->
rq_bufsize
;
/* don't have more space! */
}
error
=
copy_from_user
(
req
->
rq_data
,
buf
,
count
);
if
(
error
)
return
error
;
if
(
copy_from_user
(
req
->
rq_data
,
buf
,
count
))
return
-
EFAULT
;
/* adjust outsize: good upcalls can be aware of this */
req
->
rq_rep_size
=
count
;
...
...
@@ -280,14 +278,12 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
char
*
tmp
;
int
error
;
error
=
copy_from_user
(
&
readmount
,
(
void
*
)
arg
,
sizeof
(
readmount
));
if
(
error
)
{
if
(
copy_from_user
(
&
readmount
,
(
void
*
)
arg
,
sizeof
(
readmount
)))
printk
(
"psdev: can't copy %Zd bytes from %p to %p
\n
"
,
sizeof
(
readmount
),
(
struct
readmount
*
)
arg
,
&
readmount
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
len
=
readmount
.
io_len
;
...
...
@@ -307,15 +303,16 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
* I mean, let's let the compiler do a little work ...
* gcc suggested the extra ()
*/
error
=
copy_to_user
(
readmount
.
io_string
,
tmp
,
outlen
);
if
(
error
)
{
if
(
copy_to_user
(
readmount
.
io_string
,
tmp
,
outlen
))
{
CDEBUG
(
D_PSDEV
,
"Copy_to_user string 0x%p failed
\n
"
,
readmount
.
io_string
);
error
=
-
EFAULT
;
}
if
(
(
!
error
)
&&
(
error
=
copy_to_user
(
&
(
user_readmount
->
io_len
),
&
outlen
,
sizeof
(
int
)))
)
{
if
(
!
error
&&
copy_to_user
(
&
(
user_readmount
->
io_len
),
&
outlen
,
sizeof
(
int
))
)
{
CDEBUG
(
D_PSDEV
,
"Copy_to_user len @0x%p failed
\n
"
,
&
(
user_readmount
->
io_len
));
error
=
-
EFAULT
;
}
PRESTO_FREE
(
tmp
,
len
);
...
...
@@ -360,10 +357,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
path_len
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
path_len
+
1
);
...
...
@@ -371,11 +367,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
))
{
PRESTO_FREE
(
path
,
input
.
path_len
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
path_len
]
=
'\0'
;
CDEBUG
(
D_PSDEV
,
"clear_fsetroot: path %s
\n
"
,
path
);
...
...
@@ -401,10 +396,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
path_len
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
path_len
+
1
);
...
...
@@ -412,11 +406,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
))
{
PRESTO_FREE
(
path
,
input
.
path_len
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
path_len
]
=
'\0'
;
CDEBUG
(
D_PSDEV
,
"clear_all_fsetroot: path %s
\n
"
,
path
);
...
...
@@ -440,10 +433,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
path_len
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
path_len
+
1
);
...
...
@@ -451,11 +443,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
))
{
PRESTO_FREE
(
path
,
input
.
path_len
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
path_len
]
=
'\0'
;
CDEBUG
(
D_PSDEV
,
"get_kmlsize: len %d path %s
\n
"
,
...
...
@@ -474,7 +465,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
CDEBUG
(
D_PSDEV
,
"get_kmlsize: size = %Zd
\n
"
,
size
);
EXIT
;
return
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
));
if
(
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
)))
return
-
EFAULT
;
return
0
;
}
case
PRESTO_GET_RECNO
:
{
...
...
@@ -488,10 +481,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
path_len
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
path_len
+
1
);
...
...
@@ -499,11 +491,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
))
{
PRESTO_FREE
(
path
,
input
.
path_len
+
1
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
path
[
input
.
path_len
]
=
'\0'
;
CDEBUG
(
D_PSDEV
,
"get_recno: len %d path %s
\n
"
,
...
...
@@ -522,7 +513,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
CDEBUG
(
D_PSDEV
,
"get_recno: recno = %d
\n
"
,
(
int
)
recno
);
EXIT
;
return
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
));
if
(
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
)))
return
-
EFAULT
;
return
0
;
}
case
PRESTO_SET_FSETROOT
:
{
...
...
@@ -543,10 +536,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
flags
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
path
,
char
*
,
input
.
path_len
+
1
);
...
...
@@ -554,9 +546,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
path
,
input
.
path
,
input
.
path_len
))
{
EXIT
;
error
-
EFAULT
;
goto
exit_free_path
;
}
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -567,9 +559,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
goto
exit_free_path
;
}
error
=
copy_from_user
(
fsetname
,
input
.
name
,
input
.
name_len
);
if
(
error
)
{
if
(
copy_from_user
(
fsetname
,
input
.
name
,
input
.
name_len
))
{
EXIT
;
error
=
-
EFAULT
;
goto
exit_free_fsetname
;
}
fsetname
[
input
.
name_len
]
=
'\0'
;
...
...
@@ -621,12 +613,11 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
psdev_opt
*
user_opt
=
(
struct
psdev_opt
*
)
arg
;
int
error
;
error
=
copy_from_user
(
&
kopt
,
(
void
*
)
arg
,
sizeof
(
kopt
));
if
(
error
)
{
if
(
copy_from_user
(
&
kopt
,
(
void
*
)
arg
,
sizeof
(
kopt
)))
{
printk
(
"psdev: can't copyin %Zd bytes from %p to %p
\n
"
,
sizeof
(
kopt
),
(
struct
kopt
*
)
arg
,
&
kopt
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
minor
=
minor
(
dev
);
if
(
cmd
==
PRESTO_SETOPT
)
...
...
@@ -650,12 +641,11 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
return
error
;
}
error
=
copy_to_user
(
user_opt
,
&
kopt
,
sizeof
(
kopt
));
if
(
error
)
{
if
(
copy_to_user
(
user_opt
,
&
kopt
,
sizeof
(
kopt
)))
{
CDEBUG
(
D_PSDEV
,
"Copy_to_user opt 0x%p failed
\n
"
,
user_opt
);
EXIT
;
return
error
;
return
-
EFAULT
;
}
CDEBUG
(
D_PSDEV
,
"dosetopt minor %d, opt %d, val %d return %d
\n
"
,
minor
,
kopt
.
optname
,
kopt
.
optval
,
error
);
...
...
@@ -668,10 +658,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
lento_input_attr
input
;
struct
iattr
iattr
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
iattr
.
ia_valid
=
input
.
valid
;
iattr
.
ia_mode
=
(
umode_t
)
input
.
mode
;
...
...
@@ -692,10 +681,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_mode
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_create
(
input
.
name
,
input
.
mode
,
&
input
.
info
);
...
...
@@ -707,10 +695,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_old_new
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_link
(
input
.
oldname
,
input
.
newname
,
&
input
.
info
);
...
...
@@ -722,10 +709,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_unlink
(
input
.
name
,
&
input
.
info
);
...
...
@@ -737,10 +723,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_old_new
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_symlink
(
input
.
oldname
,
input
.
newname
,
&
input
.
info
);
...
...
@@ -752,10 +737,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_mode
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_mkdir
(
input
.
name
,
input
.
mode
,
&
input
.
info
);
...
...
@@ -767,10 +751,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_rmdir
(
input
.
name
,
&
input
.
info
);
...
...
@@ -782,10 +765,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_dev
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_mknod
(
input
.
name
,
input
.
mode
,
...
...
@@ -798,10 +780,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
int
error
;
struct
lento_input_old_new
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
error
=
lento_rename
(
input
.
oldname
,
input
.
newname
,
&
input
.
info
);
...
...
@@ -817,30 +798,27 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
char
*
name
;
char
*
buffer
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
/* Now setup the input parameters */
PRESTO_ALLOC
(
name
,
char
*
,
input
.
name_len
+
1
);
/* We need null terminated strings for attr names */
name
[
input
.
name_len
]
=
'\0'
;
error
=
copy_from_user
(
name
,
input
.
name
,
input
.
name_len
);
if
(
error
)
{
if
(
copy_from_user
(
name
,
input
.
name
,
input
.
name_len
))
{
EXIT
;
PRESTO_FREE
(
name
,
input
.
name_len
+
1
);
return
error
;
return
-
EFAULT
;
}
PRESTO_ALLOC
(
buffer
,
char
*
,
input
.
buffer_len
+
1
);
error
=
copy_from_user
(
buffer
,
input
.
buffer
,
input
.
buffer_len
);
if
(
error
)
{
if
(
copy_from_user
(
buffer
,
input
.
buffer
,
input
.
buffer_len
))
{
EXIT
;
PRESTO_FREE
(
name
,
input
.
name_len
+
1
);
PRESTO_FREE
(
buffer
,
input
.
buffer_len
+
1
);
return
error
;
return
-
EFAULT
;
}
/* Make null terminated for easy printing */
buffer
[
input
.
buffer_len
]
=
'\0'
;
...
...
@@ -869,21 +847,19 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
lento_input_ext_attr
input
;
char
*
name
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
/* Now setup the input parameters */
PRESTO_ALLOC
(
name
,
char
*
,
input
.
name_len
+
1
);
/* We need null terminated strings for attr names */
name
[
input
.
name_len
]
=
'\0'
;
error
=
copy_from_user
(
name
,
input
.
name
,
input
.
name_len
);
if
(
error
)
{
if
(
copy_from_user
(
name
,
input
.
name
,
input
.
name_len
))
{
EXIT
;
PRESTO_FREE
(
name
,
input
.
name_len
+
1
);
return
error
;
return
-
EFAULT
;
}
CDEBUG
(
D_PSDEV
,
" delextattr params: name %s,"
...
...
@@ -907,10 +883,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
lento_input_iopen
input
;
int
error
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
input
.
fd
=
lento_iopen
(
input
.
name
,
(
ino_t
)
input
.
ino
,
...
...
@@ -921,17 +896,18 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
return
input
.
fd
;
}
EXIT
;
return
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
));
if
(
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
)))
return
-
EFAULT
;
return
0
;
}
case
PRESTO_VFS_CLOSE
:
{
int
error
;
struct
lento_input_close
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
CDEBUG
(
D_PIOCTL
,
"lento_close file descriptor: %d
\n
"
,
input
.
fd
);
...
...
@@ -952,10 +928,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
presto_version
remote_file_version
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
user_path
=
input
.
path
;
...
...
@@ -964,11 +939,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
input
.
path
,
input
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
input
.
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -996,10 +970,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
struct
lento_vfs_context
info
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
user_path
=
input
.
path
;
...
...
@@ -1008,11 +981,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
input
.
path
,
input
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
input
.
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -1035,10 +1007,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
__u32
path_len
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
user_path
=
input
.
path
;
...
...
@@ -1047,11 +1018,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
input
.
path
,
input
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
input
.
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -1072,10 +1042,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
__u32
recno
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
user_path
=
input
.
path
;
...
...
@@ -1084,11 +1053,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
input
.
path
,
input
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
input
.
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -1111,10 +1079,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
char
*
path
;
}
input
;
error
=
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
));
if
(
error
)
{
if
(
copy_from_user
(
&
input
,
(
char
*
)
arg
,
sizeof
(
input
)))
{
EXIT
;
return
error
;
return
-
EFAULT
;
}
user_path
=
input
.
path
;
...
...
@@ -1123,11 +1090,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
input
.
path
,
user_path
,
input
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
input
.
path
,
input
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
input
.
path
[
input
.
path_len
]
=
'\0'
;
...
...
@@ -1190,7 +1156,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
}
/* return the correct cookie to wait for */
input
.
mark_what
=
res
;
return
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
));
if
(
copy_to_user
((
char
*
)
arg
,
&
input
,
sizeof
(
input
)))
return
-
EFAULT
;
return
0
;
}
#ifdef CONFIG_KREINT
...
...
@@ -1211,11 +1179,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
char
*
path
;
}
permit
;
error
=
copy_from_user
(
&
permit
,
(
char
*
)
arg
,
sizeof
(
permit
));
if
(
error
)
{
if
(
copy_from_user
(
&
permit
,
(
char
*
)
arg
,
sizeof
(
permit
)))
{
EXIT
;
return
error
;
}
return
-
EFAULT
;
}
user_path
=
permit
.
path
;
PRESTO_ALLOC
(
permit
.
path
,
char
*
,
permit
.
path_len
+
1
);
...
...
@@ -1223,11 +1190,10 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
EXIT
;
return
-
ENOMEM
;
}
error
=
copy_from_user
(
permit
.
path
,
user_path
,
permit
.
path_len
);
if
(
error
)
{
if
(
copy_from_user
(
permit
.
path
,
user_path
,
permit
.
path_len
))
{
EXIT
;
PRESTO_FREE
(
permit
.
path
,
permit
.
path_len
+
1
);
return
error
;
return
-
EFAULT
;
}
permit
.
path
[
permit
.
path_len
]
=
'\0'
;
...
...
@@ -1241,7 +1207,9 @@ static int presto_psdev_ioctl(struct inode *inode, struct file *file,
return
error
;
}
/* return the correct cookie to wait for */
return
copy_to_user
((
char
*
)
arg
,
&
permit
,
sizeof
(
permit
));
if
(
copy_to_user
((
char
*
)
arg
,
&
permit
,
sizeof
(
permit
)))
return
-
EFAULT
;
return
0
;
}
default:
...
...
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