[PATCH] squashed fixes for MTP
ANDROID: usb: gadget: fix NULL ptr derefer while symlinking PTP func Fix NULL pointer dereference while trying to link PTP function to a gadget configuration without creating MTP function. PTP piggyback on MTP function so make sure we have MTP function created beforehand. Otherwise we run into following kernel panic: ----------------------- [ 70.329957] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [ 70.330738] pgd = dd8ec000 [ 70.330916] [00000000] *pgd=00000000 [ 70.331663] Internal error: Oops: 805 [#1] SMP THUMB2 [ 70.332155] CPU: 0 PID: 2067 Comm: ln Not tainted 3.18.0-00587-gdfa582e #1 [ 70.332511] task: dd9c92c0 ti: dd822000 task.ti: dd822000 [ 70.333094] PC is at function_alloc_mtp_ptp+0xe/0x68 [ 70.333311] LR is at usb_get_function+0x11/0x1c [ 70.333489] pc : [<c034ec12>] lr : [<c033cce9>] psr: 60070033 <..snip..> [ 70.384111] 3fc0: bec14ae4 00000004 bec14c0a 00000053 00000004 b6f0422d 00000000 bec14adc [ 70.384369] 3fe0: bec14af8 bec14a98 b6f071f3 b6e8977c 20070010 bec14c0d 00000000 00000000 [ 70.384832] [<c034ec12>] (function_alloc_mtp_ptp) from [<c033cce9>] (usb_get_function+0x11/0x1c) [ 70.385146] [<c033cce9>] (usb_get_function) from [<c033da9b>] (config_usb_cfg_link+0x87/0xa8) [ 70.385421] [<c033da9b>] (config_usb_cfg_link) from [<c011f417>] (configfs_symlink+0xb7/0x1c8) [ 70.385696] [<c011f417>] (configfs_symlink) from [<c00dcd8d>] (vfs_symlink+0x85/0xc0) [ 70.386010] [<c00dcd8d>] (vfs_symlink) from [<c00dce0b>] (SyS_symlinkat+0x43/0x70) [ 70.386261] [<c00dce0b>] (SyS_symlinkat) from [<c000ce41>] (ret_fast_syscall+0x1/0x5c) [ 70.386610] Code: eb04 4a0f 6e03 480f (e883) 0005 [ 70.387346] ---[ end trace 8dba7c552e02f8fa ]--- [ 70.387647] Kernel panic - not syncing: Fatal exception [ 70.387980] ---[ end Kernel panic - not syncing: Fatal exception ----------------------- Steps to reproduce the kernel panic: mount -t configfs none /config mkdir /config/usb_gadget/g1 cd /config/usb_gadget/g1 echo 0x18d1 > idVendor echo 0x4e26 > idProduct mkdir strings/0x409 echo 0123459876 > strings/0x409/serialnumber echo Asus > strings/0x409/manufacturer echo Nexus7 > strings/0x409/product mkdir configs/c.1 mkdir configs/c.1/strings/0x409 echo "Conf 1" > configs/c.1/strings/0x409/configuration echo 120 > configs/c.1/MaxPower mkdir functions/ptp.ptp ln -s functions/ptp.ptp configs/c.1/ptp.ptp Also MTP and PTP are mutually exclusive functions so make sure we have only one of it linked to a configuration at a time. Otherwise it opens up another set of bug(s?). Change-Id: I484c02e77b3210e3babd8c470be843ef208b3464 Signed-off-by:Amit Pundir <amit.pundir@linaro.org> ANDROID: usb: gadget: f_mtp: don't use le16 for u8 field The 'bCount' field is u8. Noticed by this warning: drivers/usb/gadget/function/f_mtp.c:264:3: warning: large integer implicitly truncated to unsigned type [-Woverflow] Change-Id: Ie82dfd1a8986ecd3acf143e41c46822f0d1aca4f Signed-off-by:
Brian Norris <briannorris@google.com> ANDROID: usb: gadget: fix MTP enumeration issue under super speed mode MTP function doesn't show as a drive in Windows when the device is connected to PC's USB3 port, because device fails to respond ACK to BULK OUT transfer request. This patch modifies MTP OUT request length as multiple of MaxPacketSize per databook requirement in order to fix this issue. Patchset: mtp Change-Id: I090d7880ff00c499dc5ba7fd644b1fe7cd87fcb5 Signed-off-by:
Jiebing Li <jiebing.li@intel.com> Signed-off-by:
Wang, Yu <yu.y.wang@intel.com> Signed-off-by:
Russ Weight <russell.h.weight@intel.com> ANDROID: usb: gadget: f_mtp: Set 0xFFFFFFFF in mtp header ContainerLength field Value 0xFFFFFFFF should be set according specification of MTP for large files when fileSize + mtpHeader is greater than 0xFFFFFFFF. MTP Specification, Appendix H - USB Optimizations Patchset: mtp Change-Id: I6213de052914350be2f87b73f8135f9c0cd05d7c Signed-off-by:
Witold Sciuk <witold.sciuk@intel.com> Signed-off-by:
Konrad Leszczynski <konrad.leszczynski@intel.com> Signed-off-by:
Russ Weight <russell.h.weight@intel.com> ANDROID: usb: f_mtp: return error code if transfer error in receive_file_work function receive_file_work() function should report error if it detect the urb is not successfully transfered. Patchset: mtp Change-Id: I66898afe6b6ea2c33e6ea4c5ccf47d3a56d002dc Signed-off-by:
Du, Changbin <changbin.du@gmail.com> Signed-off-by:
Wang, Yu <yu.y.wang@intel.com> Signed-off-by:
Russ Weight <russell.h.weight@intel.com> ANDROID: usb: gadget: fix NULL pointer issue in mtp_read() pointer dev->ep_out->desc is set to NULL if MTP function is disabled during read operation. So we need to do pointer check before access it and add spin lock protection in case it's modified at another place in future. Patchset: mtp Change-Id: I96d3d685e93276c9065a1aa7b0cbbdc2e159aa6f Signed-off-by:
Jiebing Li <jiebing.li@intel.com> Signed-off-by:
Wang, Yu <yu.y.wang@intel.com> Signed-off-by:
Russ Weight <russell.h.weight@intel.com> usb: gadget: added missing usb_ep_align(_maybe) and dependencies Change-Id: I171d92680d056e5358db5a43214699b11df36e6f usb: gadget: return correct value in mtp_bind_config() Change-Id: I88fcda139f16768ca3b7fb7a83a3b3b827601bee
Loading
Please register or sign in to comment