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
1e9a5829
Commit
1e9a5829
authored
Mar 25, 2004
by
Oliver Neukum
Committed by
Greg Kroah-Hartman
Mar 25, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: fix DMA to stack in ftdi driver
this driver is doing DMA to the stack. Here's the obvious fix.
parent
d1bc364e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
9 deletions
+35
-9
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.c
+35
-9
No files found.
drivers/usb/serial/ftdi_sio.c
View file @
1e9a5829
...
@@ -790,8 +790,14 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud)
...
@@ -790,8 +790,14 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud)
static
int
set_rts
(
struct
usb_serial_port
*
port
,
int
high_or_low
)
static
int
set_rts
(
struct
usb_serial_port
*
port
,
int
high_or_low
)
{
{
struct
ftdi_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
ftdi_private
*
priv
=
usb_get_serial_port_data
(
port
);
char
buf
[
1
]
;
char
*
buf
;
unsigned
ftdi_high_or_low
;
unsigned
ftdi_high_or_low
;
int
rv
;
buf
=
kmalloc
(
1
,
GFP_NOIO
);
if
(
!
buf
)
return
-
ENOMEM
;
if
(
high_or_low
)
{
if
(
high_or_low
)
{
ftdi_high_or_low
=
FTDI_SIO_SET_RTS_HIGH
;
ftdi_high_or_low
=
FTDI_SIO_SET_RTS_HIGH
;
priv
->
last_dtr_rts
|=
TIOCM_RTS
;
priv
->
last_dtr_rts
|=
TIOCM_RTS
;
...
@@ -799,20 +805,29 @@ static int set_rts(struct usb_serial_port *port, int high_or_low)
...
@@ -799,20 +805,29 @@ static int set_rts(struct usb_serial_port *port, int high_or_low)
ftdi_high_or_low
=
FTDI_SIO_SET_RTS_LOW
;
ftdi_high_or_low
=
FTDI_SIO_SET_RTS_LOW
;
priv
->
last_dtr_rts
&=
~
TIOCM_RTS
;
priv
->
last_dtr_rts
&=
~
TIOCM_RTS
;
}
}
r
eturn
(
usb_control_msg
(
port
->
serial
->
dev
,
r
v
=
usb_control_msg
(
port
->
serial
->
dev
,
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
FTDI_SIO_SET_MODEM_CTRL_REQUEST
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE
,
ftdi_high_or_low
,
0
,
ftdi_high_or_low
,
0
,
buf
,
0
,
WDR_TIMEOUT
));
buf
,
0
,
WDR_TIMEOUT
);
kfree
(
buf
);
return
rv
;
}
}
static
int
set_dtr
(
struct
usb_serial_port
*
port
,
int
high_or_low
)
static
int
set_dtr
(
struct
usb_serial_port
*
port
,
int
high_or_low
)
{
{
struct
ftdi_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
ftdi_private
*
priv
=
usb_get_serial_port_data
(
port
);
char
buf
[
1
]
;
char
*
buf
;
unsigned
ftdi_high_or_low
;
unsigned
ftdi_high_or_low
;
int
rv
;
buf
=
kmalloc
(
1
,
GFP_NOIO
);
if
(
!
buf
)
return
-
ENOMEM
;
if
(
high_or_low
)
{
if
(
high_or_low
)
{
ftdi_high_or_low
=
FTDI_SIO_SET_DTR_HIGH
;
ftdi_high_or_low
=
FTDI_SIO_SET_DTR_HIGH
;
priv
->
last_dtr_rts
|=
TIOCM_DTR
;
priv
->
last_dtr_rts
|=
TIOCM_DTR
;
...
@@ -820,12 +835,15 @@ static int set_dtr(struct usb_serial_port *port, int high_or_low)
...
@@ -820,12 +835,15 @@ static int set_dtr(struct usb_serial_port *port, int high_or_low)
ftdi_high_or_low
=
FTDI_SIO_SET_DTR_LOW
;
ftdi_high_or_low
=
FTDI_SIO_SET_DTR_LOW
;
priv
->
last_dtr_rts
&=
~
TIOCM_DTR
;
priv
->
last_dtr_rts
&=
~
TIOCM_DTR
;
}
}
r
eturn
(
usb_control_msg
(
port
->
serial
->
dev
,
r
v
=
usb_control_msg
(
port
->
serial
->
dev
,
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
FTDI_SIO_SET_MODEM_CTRL_REQUEST
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE
,
FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE
,
ftdi_high_or_low
,
0
,
ftdi_high_or_low
,
0
,
buf
,
0
,
WDR_TIMEOUT
));
buf
,
0
,
WDR_TIMEOUT
);
kfree
(
buf
);
return
rv
;
}
}
...
@@ -834,21 +852,29 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port);
...
@@ -834,21 +852,29 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port);
static
int
change_speed
(
struct
usb_serial_port
*
port
)
static
int
change_speed
(
struct
usb_serial_port
*
port
)
{
{
char
buf
[
1
]
;
char
*
buf
;
__u16
urb_value
;
__u16
urb_value
;
__u16
urb_index
;
__u16
urb_index
;
__u32
urb_index_value
;
__u32
urb_index_value
;
int
rv
;
buf
=
kmalloc
(
1
,
GFP_NOIO
);
if
(
!
buf
)
return
-
ENOMEM
;
urb_index_value
=
get_ftdi_divisor
(
port
);
urb_index_value
=
get_ftdi_divisor
(
port
);
urb_value
=
(
__u16
)
urb_index_value
;
urb_value
=
(
__u16
)
urb_index_value
;
urb_index
=
(
__u16
)(
urb_index_value
>>
16
);
urb_index
=
(
__u16
)(
urb_index_value
>>
16
);
r
eturn
(
usb_control_msg
(
port
->
serial
->
dev
,
r
v
=
usb_control_msg
(
port
->
serial
->
dev
,
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
usb_sndctrlpipe
(
port
->
serial
->
dev
,
0
),
FTDI_SIO_SET_BAUDRATE_REQUEST
,
FTDI_SIO_SET_BAUDRATE_REQUEST
,
FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE
,
FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE
,
urb_value
,
urb_index
,
urb_value
,
urb_index
,
buf
,
0
,
100
)
<
0
);
buf
,
0
,
100
);
kfree
(
buf
);
return
rv
;
}
}
...
...
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