android_kernel_xiaomi_sm8350/drivers/char
Paul Mackerras 289a1e995e [PATCH] Fix for the PPTP hangs that have been reported
People have been reporting that PPP connections over ptys, such as
used with PPTP, will hang randomly when transferring large amounts of
data, for instance in http://bugzilla.kernel.org/show_bug.cgi?id=6530.
I have managed to reproduce the problem, and the patch below fixes the
actual cause.

The problem is not in fact in ppp_async.c but in n_tty.c.  What
happens is that when pptp reads from the pty, we call read_chan() in
drivers/char/n_tty.c on the master side of the pty.  That copies all
the characters out of its buffer to userspace and then calls
check_unthrottle(), which calls the pty unthrottle routine, which
calls tty_wakeup on the slave side, which calls ppp_asynctty_wakeup,
which calls tasklet_schedule.  So far so good.  Since we are in
process context, the tasklet runs immediately and calls
ppp_async_process(), which calls ppp_async_push, which calls the
tty->driver->write function to send some more output.

However, tty->driver->write() returns zero, because the master
tty->receive_room is still zero.  We haven't returned from
check_unthrottle() yet, and read_chan() only updates tty->receive_room
_after_ calling check_unthrottle.  That means that the driver->write
call in ppp_async_process() returns 0.  That would be fine if we were
going to get a subsequent wakeup call, but we aren't (we just had it,
and the buffer is now empty).

The solution is for n_tty.c to update tty->receive_room _before_
calling the driver unthrottle routine.  The patch below does this.
With this patch I was able to transfer a 900MB file over a PPTP
connection (taking about 25 minutes), whereas without the patch the
connection would always stall in under a minute.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-11 20:40:39 -07:00
..
agp [AGPGART] VIA PT880 Ultra support. 2006-05-22 13:56:02 -04:00
drm drm: possible cleanups 2006-04-23 18:26:40 +10:00
ftape drivers/char/ftape/lowlevel/fdc-io.c: Correct a comment 2006-03-26 19:18:07 +02:00
ip2
ipmi [PATCH] IPMI: reserve I/O ports separately 2006-05-31 16:27:10 -07:00
mwave [PATCH] fix array overrun in drivers/char/mwave/mwavedd.c 2006-04-28 08:33:46 -07:00
pcmcia [PATCH] pcmcia: fix zeroing of cm4000_cs.c data 2006-06-02 00:57:31 +02:00
rio [PATCH] Final rio polish 2006-05-15 11:20:57 -07:00
tpm [PATCH] tpm: more bios log parsing fixes 2006-05-31 16:27:10 -07:00
watchdog [WATCHDOG] s3c2410_wdt.c stop watchdog after boot 2006-05-15 21:38:14 +02:00
.gitignore
amiserial.c [PATCH] kill _INLINE_ 2006-03-23 07:38:16 -08:00
applicom.c [PATCH] Wrong out of range check in drivers/char/applicom.c 2006-04-11 06:18:46 -07:00
applicom.h
cd1865.h
ChangeLog
consolemap.c
cp437.uni
cs5535_gpio.c [PATCH] cs5535_gpio.c: call cdev_del() during module_exit to unmap kobject references and other cleanups 2006-04-20 07:54:03 -07:00
cyclades.c
decserial.c
defkeymap.c_shipped
defkeymap.map
digi1.h
digi.h
digiFep1.h
digiPCI.h
ds1286.c
ds1302.c
ds1620.c
dsp56k.c
dtlk.c [PATCH] Remove extraneous \n in doubletalk init printk. 2006-04-11 06:18:41 -07:00
ec3104_keyb.c
efirtc.c
epca.c BUG_ON() Conversion in drivers/char 2006-03-26 18:17:21 +02:00
epca.h
epcaconfig.h
esp.c
generic_nvram.c [PATCH] powerpc: Kill _machine and hard-coded platform numbers 2006-03-28 23:15:54 +11:00
generic_serial.c [PATCH] sem2mutex: serial ->port_write_mutex 2006-03-23 07:38:14 -08:00
genrtc.c [PATCH] genrtc: fix read on 64-bit platforms 2006-05-01 18:17:47 -07:00
hangcheck-timer.c
hpet.c
hvc_console.c [PATCH] powerpc: hvc_console updates 2006-03-28 16:45:26 +11:00
hvc_console.h [PATCH] powerpc: hvc_console updates 2006-03-28 16:45:26 +11:00
hvc_rtas.c [PATCH] powerpc: add hvc backend for rtas 2006-03-28 16:45:28 +11:00
hvc_vio.c [PATCH] powerpc: hvc_console updates 2006-03-28 16:45:26 +11:00
hvcs.c [PATCH] powerpc/pseries: Change H_StudlyCaps to H_SHOUTING_CAPS 2006-04-01 22:36:57 +11:00
hvsi.c
hw_random.c
i8k.c
ip27-rtc.c
isicom.c
istallion.c [PATCH] drivers/char/[i]stallion: Clean up kmalloc usage 2006-03-31 12:18:56 -08:00
ite_gpio.c
Kconfig [PATCH] Final rio polish 2006-05-15 11:20:57 -07:00
keyboard.c Input: allow using several chords for braille 2006-04-26 00:14:10 -04:00
lcd.c
lcd.h
lp.c
Makefile [PATCH] powerpc: console_initcall ordering issues 2006-06-10 11:02:05 -07:00
mbcs.c
mbcs.h
mem.c [PATCH] splice: add ->splice_write support for /dev/null 2006-04-26 14:40:08 +02:00
misc.c [PATCH] mark f_ops const in the inode 2006-03-28 09:16:05 -08:00
mmtimer.c
moxa.c
mxser.c [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
mxser.h [PATCH] Typo fixes 2006-03-28 09:16:08 -08:00
n_hdlc.c
n_r3964.c
n_tty.c [PATCH] Fix for the PPTP hangs that have been reported 2006-06-11 20:40:39 -07:00
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
ppdev.c [PATCH] parport: move PP_MAJOR from ppdev.h to major.h 2006-03-25 08:22:53 -08:00
pty.c
qtronix.c
qtronixmap.c_shipped
qtronixmap.map
random.c [IPV6]: Unexport secure_ipv6_port_ephemeral 2006-04-09 22:29:17 -07:00
raw.c
riscom8_reg.h
riscom8.c [PATCH] Remove MODULE_PARM 2006-03-25 08:22:52 -08:00
riscom8.h
rocket_int.h
rocket.c
rocket.h
rtc.c
s3c2410-rtc.c
scan_keyb.c
scan_keyb.h
scc.h
scx200_gpio.c
selection.c
ser_a2232.c [PATCH] sem2mutex: serial ->port_write_mutex 2006-03-23 07:38:14 -08:00
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c
snsc_event.c [PATCH] snsc kmalloc2kzalloc 2006-03-23 07:38:15 -08:00
snsc.c [PATCH] Altix snsc: duplicate kobject fix 2006-04-22 09:19:53 -07:00
snsc.h
sonypi.c [PATCH] sonypi: correct detection of new ICH7-based laptops 2006-04-20 07:54:04 -07:00
specialix_io8.h
specialix.c
stallion.c [PATCH] drivers/char/[i]stallion: Clean up kmalloc usage 2006-03-31 12:18:56 -08:00
sx.c [PATCH] sem2mutex: serial ->port_write_mutex 2006-03-23 07:38:14 -08:00
sx.h
sxboards.h
sxwindow.h
synclink_gt.c [PATCH] synclink_gt: remove uneeded async code 2006-03-28 09:16:02 -08:00
synclink.c [PATCH] Typo fixes 2006-03-28 09:16:08 -08:00
synclinkmp.c [PATCH] s/;;/;/g 2006-03-24 07:33:24 -08:00
sysrq.c [PATCH] sysrq cleanup 2006-03-25 08:22:52 -08:00
tb0219.c
tipar.c [PATCH] tipar oops fix 2006-04-28 08:33:46 -07:00
tlclk.c [PATCH] MPBL0010 driver sysfs permissions wide open 2006-04-11 06:18:43 -07:00
toshiba.c [PATCH] remove ISA legacy functions: drivers/char/toshiba.c 2006-03-24 07:33:19 -08:00
tty_io.c [PATCH] tty_insert_flip_string_flags() license fix 2006-05-23 10:35:31 -07:00
tty_ioctl.c
vc_screen.c
viocons.c
viotape.c
vme_scc.c [PATCH] sem2mutex: serial ->port_write_mutex 2006-03-23 07:38:14 -08:00
vr41xx_giu.c
vt_ioctl.c
vt.c [PATCH] revert "swsusp add check for suspension of X controlled devices" 2006-05-31 16:27:11 -07:00