Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1573454
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 |
| Date | 2017-02-03 22:30 +0100 |
| Message-ID | <t6TAC-7il-23@gated-at.bofh.it> (permalink) |
| References | <t5LYt-4tk-13@gated-at.bofh.it> <t5MKS-4Js-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Jan 31, 2017 at 02:53:47PM -0500, Alan Stern wrote: > On Tue, 31 Jan 2017, Guenter Roeck wrote: > > > When unloading the r8152 driver using the 'unbind' sysfs attribute > > in a system with KASAN enabled, the following error message is seen > > on a regular basis. > > ... > > > The two-byte allocation in conjunction with code analysis suggests that > > the interrupt buffer has been overwritten. Added instrumentation in the > > driver shows that the interrupt handler is called after RTL8152_UNPLUG > > was set, and that this event is associated with the error message above. > > This suggests that there are situations where the interrupt buffer is used > > after it has been freed. > > > > To avoid the problem, allocate the interrupt buffer as part of struct > > r8152. > > > > Cc: Hayes Wang <hayeswang@realtek.com> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > --- > > The problem is seen in chromeos-4.4, but there is not reason to believe > > that it does not occur with the upstream kernel. It is still seen in > > chromeos-4.4 after all patches from upstream and linux-next have been > > applied to the driver. > > > > While relatively simple, I am not really convinced that this is the best > > (or even an acceptable) solution for this problem. I am open to suggestions > > for a better fix. > > The proper approach is to keep the allocation as it is, but _before_ > deallocating the buffer, make sure that the interrupt buffer won't be > accessed any more. This may involve calling usb_kill_urb(), or > synchronize_irq(), or something similar. > Just to keep everyone up to date, the problem was that the usb subsystem, due to bad platform code in chromeos-4.4, did not properly stop DMA from the hardware when the driver was removed. This resulted in a DMA transfer into the freed buffer. The r8152 driver is completely innocent. Sorry for the noise. Guenter
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Guenter Roeck <linux@roeck-us.net> - 2017-01-31 20:10 +0100
Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Eric Dumazet <eric.dumazet@gmail.com> - 2017-01-31 21:00 +0100
Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Guenter Roeck <linux@roeck-us.net> - 2017-01-31 23:20 +0100
Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Alan Stern <stern@rowland.harvard.edu> - 2017-01-31 21:00 +0100
Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Guenter Roeck <linux@roeck-us.net> - 2017-01-31 23:20 +0100
Re: [PATCH] r8152: Allocate interrupt buffer as part of struct r8152 Guenter Roeck <linux@roeck-us.net> - 2017-02-03 22:30 +0100
csiph-web