[U-Boot] crash in usb_stor_get_info using pre-relocation address for ss->transport

Chris Packham judge.packham at gmail.com
Thu Jun 13 02:02:06 CEST 2013


Hi,

I've just found a crash in usb_stor_get_info (actually usb_inquiry
which gets auto-inlined). The cause seems to be that ss->transport is
set to the pre-relocation address of usb_stor_BBB_transport. Yet
ss->transport_reset is set to the correct relocated address of.

The difference between the two is that usb_stor_BBB_reset is declared
static and usb_stor_BBB_transport is not. Changing
usb_stor_BBB_transport to a static makes things work but I notice that
none of the other transport functions are static either so I'm
thinking I haven't actually fixed the problem rather just masked it.

I did  some poking with a lauterbach and from the disassembly it looks
like there is a translation table being used when the function
pointers are setup by usb_storage_probe and when declared normally
usb_stor_BBB_transport ends up at the end. Everything else has the
correct relocated address so I wonder if there is an off-by-one error
in whatever creates that table.

Does this sound familiar to anyone.

Thanks,
Chris

Extra debug info:

Board: Custom design based on P2041RDB
u-boot version: based on U-Boot 2012.10

=> usb start
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... i=0
i=1


USB Mass Storage device detected
Transport: Bulk/Bulk/Bulk
Endpoints In 1 Out 2 Int 0
Get Max LUN -> len = 1, result = 0
dev_desc 7ffbbe4c
&usb_ccb 7ffbc0c0
pccb 7ffbc0c0
 address 2
srb 7ffbc0c0
ss 7ffbbd48
ss->transport fffa98f4
ss->transport_reset 7ff586e8
Bad trap at PC: fffa98f4, SR: 29200, vector=e00
NIP: FFFA98F4 XER: 00000000 LR: 7FF59F24 REGS: 7fd2daa0 TRAP: 0e00 DAR: 00000000
MSR: 00029200 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00

GPR00: FFFA98F4 7FD2DB90 7FD2DF30 7FFBC0C0 7FFBBD48 00000000 7FFBC0C8 00000010
GPR08: FFFFFFFE 00000020 00000020 7FD2DB90 42022044 21A40D64 7FD2E238 00000000
GPR16: 7FD2EA28 00000000 00000000 00000000 00000000 7FF94E29 00000012 00000024
GPR24: 00000024 0000000C 7FF94D18 7FD2DBC0 7FFBBD48 7FFBC0C0 7FF9BE78 7FFBBE4C
Call backtrace:
7FF59EDC 7FF5A35C 7FF4BBD0 7FF4CA48 7FF51E24 7FF5247C 7FF52600
7FF56178 7FF38C4C 7FF31650
Exception in kernel pc fffa98f4 signal 0

usb_inquiry
usb_storage.c:922
usb_stor_scan
usb_storage.c:280
do_usb
cmd_usb.c:388
cmd_process
command.c:544
run_pipe_real
hush.c:1668
run_list
hush.c:2021
parse_file_outer
hush.c:3273
main_loop
main.c:431
board_init_r
board.c:1089
trap_init
start.S:1824


More information about the U-Boot mailing list