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
a465121e
Commit
a465121e
authored
May 18, 2002
by
Arnaldo Carvalho de Melo
Committed by
Linus Torvalds
May 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drivers/usr/*.c
- fix copy_{to,from}_user error handling (thanks to Rusty for pointing this out)
parent
291884c9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
17 deletions
+40
-17
drivers/usb/class/audio.c
drivers/usb/class/audio.c
+6
-2
drivers/usb/class/bluetty.c
drivers/usb/class/bluetty.c
+4
-1
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.c
+4
-3
drivers/usb/host/uhci-debug.c
drivers/usb/host/uhci-debug.c
+2
-1
drivers/usb/input/hiddev.c
drivers/usb/input/hiddev.c
+15
-5
drivers/usb/media/dabusb.c
drivers/usb/media/dabusb.c
+3
-1
drivers/usb/misc/auerswald.c
drivers/usb/misc/auerswald.c
+2
-2
drivers/usb/serial/ipaq.c
drivers/usb/serial/ipaq.c
+2
-1
drivers/usb/serial/safe_serial.c
drivers/usb/serial/safe_serial.c
+2
-1
No files found.
drivers/usb/class/audio.c
View file @
a465121e
...
@@ -2542,7 +2542,9 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
...
@@ -2542,7 +2542,9 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
if
(
as
->
usbin
.
dma
.
mapped
)
if
(
as
->
usbin
.
dma
.
mapped
)
as
->
usbin
.
dma
.
count
&=
as
->
usbin
.
dma
.
fragsize
-
1
;
as
->
usbin
.
dma
.
count
&=
as
->
usbin
.
dma
.
fragsize
-
1
;
spin_unlock_irqrestore
(
&
as
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
as
->
lock
,
flags
);
return
copy_to_user
((
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
));
if
(
copy_to_user
((
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
0
;
case
SNDCTL_DSP_GETOPTR
:
case
SNDCTL_DSP_GETOPTR
:
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
if
(
!
(
file
->
f_mode
&
FMODE_WRITE
))
...
@@ -2554,7 +2556,9 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
...
@@ -2554,7 +2556,9 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
if
(
as
->
usbout
.
dma
.
mapped
)
if
(
as
->
usbout
.
dma
.
mapped
)
as
->
usbout
.
dma
.
count
&=
as
->
usbout
.
dma
.
fragsize
-
1
;
as
->
usbout
.
dma
.
count
&=
as
->
usbout
.
dma
.
fragsize
-
1
;
spin_unlock_irqrestore
(
&
as
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
as
->
lock
,
flags
);
return
copy_to_user
((
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
));
if
(
copy_to_user
((
void
*
)
arg
,
&
cinfo
,
sizeof
(
cinfo
)))
return
-
EFAULT
;
return
0
;
case
SNDCTL_DSP_GETBLKSIZE
:
case
SNDCTL_DSP_GETBLKSIZE
:
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
if
(
file
->
f_mode
&
FMODE_WRITE
)
{
...
...
drivers/usb/class/bluetty.c
View file @
a465121e
...
@@ -490,7 +490,10 @@ static int bluetooth_write (struct tty_struct * tty, int from_user, const unsign
...
@@ -490,7 +490,10 @@ static int bluetooth_write (struct tty_struct * tty, int from_user, const unsign
retval
=
-
ENOMEM
;
retval
=
-
ENOMEM
;
goto
exit
;
goto
exit
;
}
}
copy_from_user
(
temp_buffer
,
buf
,
count
);
if
(
copy_from_user
(
temp_buffer
,
buf
,
count
))
{
retval
=
-
EFAULT
;
goto
exit
;
}
current_buffer
=
temp_buffer
;
current_buffer
=
temp_buffer
;
}
else
{
}
else
{
current_buffer
=
buf
;
current_buffer
=
buf
;
...
...
drivers/usb/class/cdc-acm.c
View file @
a465121e
...
@@ -367,9 +367,10 @@ static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned c
...
@@ -367,9 +367,10 @@ static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned c
count
=
(
count
>
acm
->
writesize
)
?
acm
->
writesize
:
count
;
count
=
(
count
>
acm
->
writesize
)
?
acm
->
writesize
:
count
;
if
(
from_user
)
if
(
from_user
)
{
copy_from_user
(
acm
->
writeurb
->
transfer_buffer
,
buf
,
count
);
if
(
copy_from_user
(
acm
->
writeurb
->
transfer_buffer
,
buf
,
count
))
else
return
-
EFAULT
;
}
else
memcpy
(
acm
->
writeurb
->
transfer_buffer
,
buf
,
count
);
memcpy
(
acm
->
writeurb
->
transfer_buffer
,
buf
,
count
);
acm
->
writeurb
->
transfer_buffer_length
=
count
;
acm
->
writeurb
->
transfer_buffer_length
=
count
;
...
...
drivers/usb/host/uhci-debug.c
View file @
a465121e
...
@@ -552,7 +552,8 @@ static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes,
...
@@ -552,7 +552,8 @@ static ssize_t uhci_proc_read(struct file *file, char *buf, size_t nbytes,
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
nbytes
))
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
nbytes
))
return
-
EINVAL
;
return
-
EINVAL
;
copy_to_user
(
buf
,
up
->
data
+
pos
,
nbytes
);
if
(
copy_to_user
(
buf
,
up
->
data
+
pos
,
nbytes
))
return
-
EFAULT
;
*
ppos
+=
nbytes
;
*
ppos
+=
nbytes
;
...
...
drivers/usb/input/hiddev.c
View file @
a465121e
...
@@ -389,7 +389,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
...
@@ -389,7 +389,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
dinfo
.
product
=
dev
->
descriptor
.
idProduct
;
dinfo
.
product
=
dev
->
descriptor
.
idProduct
;
dinfo
.
version
=
dev
->
descriptor
.
bcdDevice
;
dinfo
.
version
=
dev
->
descriptor
.
bcdDevice
;
dinfo
.
num_applications
=
hid
->
maxapplication
;
dinfo
.
num_applications
=
hid
->
maxapplication
;
return
copy_to_user
((
void
*
)
arg
,
&
dinfo
,
sizeof
(
dinfo
));
if
(
copy_to_user
((
void
*
)
arg
,
&
dinfo
,
sizeof
(
dinfo
)))
return
-
EFAULT
;
return
0
;
}
}
case
HIDIOCGFLAG
:
case
HIDIOCGFLAG
:
...
@@ -480,7 +482,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
...
@@ -480,7 +482,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
rinfo
.
num_fields
=
report
->
maxfield
;
rinfo
.
num_fields
=
report
->
maxfield
;
return
copy_to_user
((
void
*
)
arg
,
&
rinfo
,
sizeof
(
rinfo
));
if
(
copy_to_user
((
void
*
)
arg
,
&
rinfo
,
sizeof
(
rinfo
)))
return
-
EFAULT
;
return
0
;
case
HIDIOCGFIELDINFO
:
case
HIDIOCGFIELDINFO
:
{
{
...
@@ -512,7 +516,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
...
@@ -512,7 +516,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
finfo
.
unit_exponent
=
field
->
unit_exponent
;
finfo
.
unit_exponent
=
field
->
unit_exponent
;
finfo
.
unit
=
field
->
unit
;
finfo
.
unit
=
field
->
unit
;
return
copy_to_user
((
void
*
)
arg
,
&
finfo
,
sizeof
(
finfo
));
if
(
copy_to_user
((
void
*
)
arg
,
&
finfo
,
sizeof
(
finfo
)))
return
-
EFAULT
;
return
0
;
}
}
case
HIDIOCGUCODE
:
case
HIDIOCGUCODE
:
...
@@ -533,7 +539,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
...
@@ -533,7 +539,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
uref
.
usage_code
=
field
->
usage
[
uref
.
usage_index
].
hid
;
uref
.
usage_code
=
field
->
usage
[
uref
.
usage_index
].
hid
;
return
copy_to_user
((
void
*
)
arg
,
&
uref
,
sizeof
(
uref
));
if
(
copy_to_user
((
void
*
)
arg
,
&
uref
,
sizeof
(
uref
)))
return
-
EFAULT
;
return
0
;
case
HIDIOCGUSAGE
:
case
HIDIOCGUSAGE
:
case
HIDIOCSUSAGE
:
case
HIDIOCSUSAGE
:
...
@@ -564,7 +572,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
...
@@ -564,7 +572,9 @@ static int hiddev_ioctl(struct inode *inode, struct file *file,
if
(
cmd
==
HIDIOCGUSAGE
)
{
if
(
cmd
==
HIDIOCGUSAGE
)
{
uref
.
value
=
field
->
value
[
uref
.
usage_index
];
uref
.
value
=
field
->
value
[
uref
.
usage_index
];
return
copy_to_user
((
void
*
)
arg
,
&
uref
,
sizeof
(
uref
));
if
(
copy_to_user
((
void
*
)
arg
,
&
uref
,
sizeof
(
uref
)))
return
-
EFAULT
;
return
0
;
}
else
{
}
else
{
field
->
value
[
uref
.
usage_index
]
=
uref
.
value
;
field
->
value
[
uref
.
usage_index
]
=
uref
.
value
;
}
}
...
...
drivers/usb/media/dabusb.c
View file @
a465121e
...
@@ -680,7 +680,9 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm
...
@@ -680,7 +680,9 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm
ret
=
dabusb_bulk
(
s
,
pbulk
);
ret
=
dabusb_bulk
(
s
,
pbulk
);
if
(
ret
==
0
)
if
(
ret
==
0
)
ret
=
copy_to_user
((
void
*
)
arg
,
pbulk
,
sizeof
(
bulk_transfer_t
));
if
(
copy_to_user
((
void
*
)
arg
,
pbulk
,
sizeof
(
bulk_transfer_t
)))
ret
=
-
EFAULT
;
kfree
(
pbulk
);
kfree
(
pbulk
);
break
;
break
;
...
...
drivers/usb/misc/auerswald.c
View file @
a465121e
...
@@ -1553,7 +1553,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int
...
@@ -1553,7 +1553,7 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int
if
(
u
>
devinfo
.
bsize
)
{
if
(
u
>
devinfo
.
bsize
)
{
u
=
devinfo
.
bsize
;
u
=
devinfo
.
bsize
;
}
}
ret
=
copy_to_user
(
devinfo
.
buf
,
cp
->
dev_desc
,
u
);
ret
=
copy_to_user
(
devinfo
.
buf
,
cp
->
dev_desc
,
u
)
?
-
EFAULT
:
0
;
break
;
break
;
/* get the max. string descriptor length */
/* get the max. string descriptor length */
...
@@ -1803,7 +1803,7 @@ static ssize_t auerchar_write (struct file *file, const char *buf, size_t len, l
...
@@ -1803,7 +1803,7 @@ static ssize_t auerchar_write (struct file *file, const char *buf, size_t len, l
wake_up
(
&
cp
->
bufferwait
);
wake_up
(
&
cp
->
bufferwait
);
up
(
&
cp
->
mutex
);
up
(
&
cp
->
mutex
);
up
(
&
ccp
->
mutex
);
up
(
&
ccp
->
mutex
);
return
-
E
IO
;
return
-
E
FAULT
;
}
}
/* set the header byte */
/* set the header byte */
...
...
drivers/usb/serial/ipaq.c
View file @
a465121e
...
@@ -353,7 +353,8 @@ static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const un
...
@@ -353,7 +353,8 @@ static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const un
}
}
if
(
from_user
)
{
if
(
from_user
)
{
copy_from_user
(
pkt
->
data
,
buf
,
count
);
if
(
copy_from_user
(
pkt
->
data
,
buf
,
count
))
return
-
EFAULT
;
}
else
{
}
else
{
memcpy
(
pkt
->
data
,
buf
,
count
);
memcpy
(
pkt
->
data
,
buf
,
count
);
}
}
...
...
drivers/usb/serial/safe_serial.c
View file @
a465121e
...
@@ -319,7 +319,8 @@ static int safe_write (struct usb_serial_port *port, int from_user, const unsign
...
@@ -319,7 +319,8 @@ static int safe_write (struct usb_serial_port *port, int from_user, const unsign
memset
(
data
,
'0'
,
packet_length
);
memset
(
data
,
'0'
,
packet_length
);
if
(
from_user
)
{
if
(
from_user
)
{
copy_from_user
(
data
,
buf
,
count
);
if
(
copy_from_user
(
data
,
buf
,
count
))
return
-
EFAULT
;
}
else
{
}
else
{
memcpy
(
data
,
buf
,
count
);
memcpy
(
data
,
buf
,
count
);
}
}
...
...
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