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
8c9e7aa1
Commit
8c9e7aa1
authored
Jan 22, 2004
by
Oliver Neukum
Committed by
Greg Kroah-Hartman
Jan 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: fix dma to stack in ti driver
you cannot use usb_bulk_msg() on buffers on the stack.
parent
2852f0fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
drivers/usb/misc/tiglusb.c
drivers/usb/misc/tiglusb.c
+12
-2
No files found.
drivers/usb/misc/tiglusb.c
View file @
8c9e7aa1
...
...
@@ -161,7 +161,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
int
bytes_to_read
=
0
;
int
bytes_read
=
0
;
int
result
=
0
;
char
buffer
[
BULK_RCV_MAX
]
;
char
*
buffer
;
unsigned
int
pipe
;
if
(
*
f_pos
)
...
...
@@ -173,6 +173,10 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
if
(
!
s
->
dev
)
return
-
EIO
;
buffer
=
kmalloc
(
BULK_RCV_MAX
,
GFP_KERNEL
);
if
(
!
buffer
)
return
-
ENOMEM
;
bytes_to_read
=
(
count
>=
BULK_RCV_MAX
)
?
BULK_RCV_MAX
:
count
;
pipe
=
usb_rcvbulkpipe
(
s
->
dev
,
1
);
...
...
@@ -203,6 +207,7 @@ tiglusb_read (struct file *filp, char __user *buf, size_t count, loff_t * f_pos)
}
out:
kfree
(
buffer
);
return
ret
?
ret
:
bytes_read
;
}
...
...
@@ -214,7 +219,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
int
bytes_to_write
=
0
;
int
bytes_written
=
0
;
int
result
=
0
;
char
buffer
[
BULK_SND_MAX
]
;
char
*
buffer
;
unsigned
int
pipe
;
if
(
*
f_pos
)
...
...
@@ -226,6 +231,10 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
if
(
!
s
->
dev
)
return
-
EIO
;
buffer
=
kmalloc
(
BULK_SND_MAX
,
GFP_KERNEL
);
if
(
!
buffer
)
return
-
ENOMEM
;
bytes_to_write
=
(
count
>=
BULK_SND_MAX
)
?
BULK_SND_MAX
:
count
;
if
(
copy_from_user
(
buffer
,
buf
,
bytes_to_write
))
{
ret
=
-
EFAULT
;
...
...
@@ -258,6 +267,7 @@ tiglusb_write (struct file *filp, const char __user *buf, size_t count, loff_t *
}
out:
kfree
(
buffer
);
return
ret
?
ret
:
bytes_written
;
}
...
...
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