Hi,
the read urb does it, too.
Regards
Oliver
Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[EMAIL PROTECTED], 2004-05-31 17:12:36+02:00, [EMAIL PROTECTED]
- fix racy access to urb->status for read urb in throtteling code
cdc-acm.c | 12 +++++++++++-
cdc-acm.h | 2 ++
2 files changed, 13 insertions(+), 1 deletion(-)
diff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c Mon May 31 17:14:42 2004
+++ b/drivers/usb/class/cdc-acm.c Mon May 31 17:14:42 2004
@@ -203,11 +203,15 @@
tty_flip_buffer_push(tty);
}
+ spin_lock(&acm->throttle_lock);
if (acm->throttle) {
memmove(data, data + i, urb->actual_length - i);
urb->actual_length -= i;
+ acm->resubmit_to_unthrottle = 1;
+ spin_unlock(&acm->throttle_lock);
return;
}
+ spin_unlock(&acm->throttle_lock);
urb->actual_length = 0;
urb->dev = acm->dev;
@@ -378,7 +382,9 @@
struct acm *acm = tty->driver_data;
if (!ACM_READY(acm))
return;
+ spin_lock_bh(&acm->throttle_lock);
acm->throttle = 1;
+ spin_unlock_bh(&acm->throttle_lock);
}
static void acm_tty_unthrottle(struct tty_struct *tty)
@@ -386,9 +392,13 @@
struct acm *acm = tty->driver_data;
if (!ACM_READY(acm))
return;
+ spin_lock_bh(&acm->throttle_lock);
acm->throttle = 0;
- if (acm->readurb->status != -EINPROGRESS)
+ spin_unlock_bh(&acm->throttle_lock);
+ if (acm->resubmit_to_unthrottle) {
+ acm->resubmit_to_unthrottle = 0;
acm_read_bulk(acm->readurb, NULL);
+ }
}
static void acm_tty_break_ctl(struct tty_struct *tty, int state)
diff -Nru a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
--- a/drivers/usb/class/cdc-acm.h Mon May 31 17:14:42 2004
+++ b/drivers/usb/class/cdc-acm.h Mon May 31 17:14:42 2004
@@ -89,6 +89,7 @@
struct acm_line line; /* line coding (bits, stop,
parity) */
struct work_struct work; /* work queue entry for line
discipline waking up */
struct tasklet_struct bh; /* rx processing */
+ spinlock_t throttle_lock; /* synchronize throtteling and
read callback */
unsigned int ctrlin; /* input control lines (DCD,
DSR, RI, break, overruns) */
unsigned int ctrlout; /* output control lines (DTR,
RTS) */
unsigned int writesize; /* max packet size for the
output bulk endpoint */
@@ -97,6 +98,7 @@
unsigned char throttle; /* throttled by tty layer */
unsigned char clocal; /* termios CLOCAL */
unsigned char ready_for_write; /* write urb can be used */
+ unsigned char resubmit_to_unthrottle; /* throtteling has disabled
the read urb */
};
/* "Union Functional Descriptor" from CDC spec 5.2.3.X */
===================================================================
This BitKeeper patch contains the following changesets:
1.1762
## Wrapped with gzip_uu ##
M'XL( .)+NT \56:V_3,!3]'/^**TU"&U,;7SN/IE,GG@($$M. SY7CN$VT
MU)[EMAIL PROTECTED](M1]=BKRN),U60'WE;&CKV%
MD*FR^5"KYJ19#*MZ[K:.J\IM^7FU4/XRWO]<*V5\*QAQ^T?"RAS<LAE[..17
M*_;B5(V]X]=OOGQX?DS(9 (O<Z'GZI.R,)D06]5GHLS,,V'SLM)#6PMM%LJ*
MH:[EMAIL PROTECTED],6HQH$+<2,T01H,HH"T910):)/;M;P#I20$..R)$A
M;[EMAIL PROTECTED] 3D%> [EMAIL PROTECTED]:^AP!XS&R,8_V*1M3"O<BPSZ# 24OX.]6\I)(&,"L
M.(=:R [EMAIL PROTECTED]&P.SJH9:B:Q;A$*#S>O*6E46>@ZRRA1Y#V&0
MT(@<73>=#'[EMAIL PROTECTED],Z 8MV$4)U&;2A[.$&<L
MX#.NXO3^OJXARE(8X\M,#JZPES,,D;&D=1W#D4MQ&[!\!49IS!)D+>4T#MJ8
[EMAIL PROTECTED],A8LD'^&O4J484!Y+X(-+W6R^(>5_!FVDTWWHZ71"*->-ORV9ECR
[EMAIL PROTECTED],+"K!3SI4[6M:%M795.'LN!?(1!_;7_.KH?;9K-%NIYE[C&
M$,^<%KJLY,G47J92JFGW?.!YGO\4S(66;ED7W]1:JD)G2XE+49:ID"?PU'>0
M20?9:%/,M7)[N>B,P#3IHK!36TT;O3KCH$>[EMAIL PROTECTED] UEA1%JZ-VVNKAW$(6^F
MIGS8L;?T@:U(*6]Z.8:LQ80GV)/RKI,_AI6(,,!_1,O&J-NT=&Y^R<35\(PI
[EMAIL PROTECTED]&YKBZ=+E'<U5NPU57S(JL/3MWGSBHP>$:8_<[EMAIL PROTECTED],.)Y_>ZO
MF0<3P ,7TF,U>B,:TJM3-T?R$5W+;YKF]X?B+="-P:-'XK[B29?"N^[&'PGO
K%3/8W="J/?C^8"]IE^722GY<_]^2N9(GIEE,5!1G,\Z0_ 1DU_4QU D
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel