usb: fix adb reboot panic.
authorYue Wang <yue.wang@amlogic.com>
Mon, 26 Jun 2017 10:30:44 +0000 (18:30 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 27 Jun 2017 02:08:16 +0000 (19:08 -0700)
commit99a3f481278b602a26377ca5f3cec4cc25aa9bde
tree3509fdbdc2af92ca3e1aaa7cd575859d1e9e5f91
parent70d09082cc6cbde3f4aaacad449cf27063080c45
usb: fix adb reboot panic.

PD#146539: usb: fix adb reboot panic.

Avoid kernel panic caused by race condition. For example,
1. In the ffs_epfile_io function, data buffer is allocated
for non-halt requests and the address of this buffer is
writed to usb controller registers.
2. After adb process be killed, data buffer is freed and
this memory is allocated for the other. But the address
is hold by the controller.
3. Adbd in PC is running. So, the controller receive the
data and write to this memory.
4. The value of this memory is modified by the controller.
This could cause the kernel panic.

To avoid this, during FunctionFS mount, we allocated the
data buffer for requests. And the memory resources has
been released in kill_sb.

Change-Id: I494988e48bb40a21d57adcf38d41c126f9b71978
Signed-off-by: Yue Wang <yue.wang@amlogic.com>
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/u_fs.h