Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
06458191
Commit
06458191
authored
May 27, 2006
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] copy_to_user() from iomem is a bad thing
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
6bc540e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
drivers/char/rio/rioctrl.c
drivers/char/rio/rioctrl.c
+16
-4
No files found.
drivers/char/rio/rioctrl.c
View file @
06458191
...
...
@@ -126,6 +126,18 @@ static int
#define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
static
int
copy_from_io
(
void
__user
*
to
,
void
__iomem
*
from
,
size_t
size
)
{
void
*
buf
=
kmalloc
(
size
,
GFP_KERNEL
);
int
res
=
-
ENOMEM
;
if
(
buf
)
{
rio_memcpy_fromio
(
buf
,
from
,
size
);
res
=
copy_to_user
(
to
,
buf
,
size
);
kfree
(
buf
);
}
return
res
;
}
int
riocontrol
(
struct
rio_info
*
p
,
dev_t
dev
,
int
cmd
,
unsigned
long
arg
,
int
su
)
{
uint
Host
;
/* leave me unsigned! */
...
...
@@ -893,7 +905,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
** Fetch the parmmap
*/
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_PARMS
\n
"
);
if
(
copy_
to_user
(
argp
,
p
->
RIOHosts
[
host
].
ParmMapP
,
sizeof
(
PARM_MAP
)))
{
if
(
copy_
from_io
(
argp
,
p
->
RIOHosts
[
host
].
ParmMapP
,
sizeof
(
PARM_MAP
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_PARMS: Copy out to user space failed
\n
"
);
return
-
EFAULT
;
...
...
@@ -947,7 +959,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_DPRAM: Bad copy to user space
\n
"
);
return
-
EFAULT
;
}
}
else
if
(
copy_
to_user
(
HostDpRam
.
DpRamP
,
p
->
RIOHosts
[
HostDpRam
.
HostNum
].
Caddr
,
sizeof
(
struct
DpRam
)))
{
}
else
if
(
copy_
from_io
(
HostDpRam
.
DpRamP
,
p
->
RIOHosts
[
HostDpRam
.
HostNum
].
Caddr
,
sizeof
(
struct
DpRam
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_DPRAM: Bad copy to user space
\n
"
);
return
-
EFAULT
;
...
...
@@ -1021,7 +1033,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
}
rio_dprintk
(
RIO_DEBUG_CTRL
,
"Request for rup %d from host %d
\n
"
,
RupReq
.
RupNum
,
RupReq
.
HostNum
);
if
(
copy_
to_user
(
RupReq
.
RupP
,
HostP
->
UnixRups
[
RupReq
.
RupNum
].
RupP
,
sizeof
(
struct
RUP
)))
{
if
(
copy_
from_io
(
RupReq
.
RupP
,
HostP
->
UnixRups
[
RupReq
.
RupNum
].
RupP
,
sizeof
(
struct
RUP
)))
{
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_RUP: Bad copy to user space
\n
"
);
return
-
EFAULT
;
...
...
@@ -1058,7 +1070,7 @@ int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su
}
rio_dprintk
(
RIO_DEBUG_CTRL
,
"Request for lpb %d from host %d
\n
"
,
LpbReq
.
Link
,
LpbReq
.
Host
);
if
(
copy_
to_user
(
LpbReq
.
LpbP
,
&
HostP
->
LinkStrP
[
LpbReq
.
Link
],
sizeof
(
struct
LPB
)))
{
if
(
copy_
from_io
(
LpbReq
.
LpbP
,
&
HostP
->
LinkStrP
[
LpbReq
.
Link
],
sizeof
(
struct
LPB
)))
{
rio_dprintk
(
RIO_DEBUG_CTRL
,
"RIO_HOST_LPB: Bad copy to user space
\n
"
);
p
->
RIOError
.
Error
=
COPYOUT_FAILED
;
return
-
EFAULT
;
...
...
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