diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2015-08-01 10:04:41 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2015-08-01 10:05:48 +0530 |
commit | 7bcb35707461da71ab35d102536810b1876a7762 (patch) | |
tree | 1fd6832f6f705eee0432fc759bbd4dcbe6b5a298 /net/ipv6 | |
parent | f06587cf9e981465e8768f4d533d1044fcbc35aa (diff) |
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:
-----------------------
[ 37.265726] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 37.266518] pgd = ddb58000
[ 37.266830] [00000000] *pgd=00000000
[ 37.267759] Internal error: Oops: 805 [#1] SMP THUMB2
[ 37.268473] CPU: 0 PID: 1974 Comm: ln Not tainted 3.14.0-00645-gf06587c #1
[ 37.269084] task: dc494b80 ti: dc4b6000 task.ti: dc4b6000
[ 37.269908] PC is at function_alloc_mtp_ptp+0xe/0x68
[ 37.270348] LR is at usb_get_function+0x11/0x1c
<..snip..>
[ 37.362593] ---[ end trace b51362b88516de68 ]---
[ 37.363431] 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?).
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'net/ipv6')
0 files changed, 0 insertions, 0 deletions