Ticket #18424: 0001-ltq-hcd-Refuse-to-submit-an-URB-marked-for-rejection.patch

File 0001-ltq-hcd-Refuse-to-submit-an-URB-marked-for-rejection.patch, 2.5 KB (added by vpelletier, 3 years ago)

Quick hack

  • package/kernel/lantiq/ltq-hcd/src/ifxhcd.c

    From fcd42694a0e2be12d05e313218061e226820363f Mon Sep 17 00:00:00 2001
    Message-Id: <fcd42694a0e2be12d05e313218061e226820363f.1417247093.git.plr.vincent@gmail.com>
    From: Vincent Pelletier <plr.vincent@gmail.com>
    Date: Fri, 28 Nov 2014 08:33:49 +0100
    Subject: ltq-hcd: Refuse to submit an URB marked for rejection.
    
    Fixes this type of hang:
    root@OpenWrt:/# echo w > /proc/sysrq-trigger
    [   98.160000] SysRq : Show Blocked State
    [   98.160000]   task                PC stack   pid father
    [   98.160000] gcom            D 8030861c     0  2228   2188 0x08100020
    [   98.160000] Stack : 81bde880 00000001 00000000 80307b18 81bde880 80435698 81bde88c 80414c60
    	  81d213c0 00010000 80410000 81bb7180 00000001 8030861c 81bcd480 81452e00
    	  81452e00 803a0000 00000000 814bf070 8007fc04 80435698 80435698 81452e00
    	  803a0000 00000004 81d21380 00000010 81be2800 81828900 00000000 81d08c28
    	  00000000 00000000 81be2804 81be2884 81452e00 803a0000 00000000 81d08c28
    	  ...
    [   98.160000] Call Trace:
    [   98.160000] [<8000d954>] __schedule+0x4cc/0x578
    [   98.160000] [<8030861c>] usb_kill_urb+0xe0/0x164
    [   98.160000] [<81828900>] usb_wwan_close+0x100/0x2e4 [usb_wwan]
    [   98.160000] [<802b6e8c>] tty_port_shutdown+0xc0/0xdc
    [   98.160000] [<802b64ac>] tty_port_close+0x30/0xa4
    [   98.160000] [<802b7918>] tty_release+0x168/0x524
    [   98.160000] [<80041038>] __fput+0xf8/0x274
    [   98.160000] [<80289560>] task_work_run+0xf0/0x128
    [   98.160000] [<800ef3d0>] do_exit+0x3fc/0x858
    [   98.160000] [<800f154c>] do_group_exit+0x78/0xb4
    [   98.160000] [<800198a8>] SyS_faccessat+0x0/0x250
    
    
    This driver does not call usb_hcd_link_urb_to_ep, which does do this test.
    As a minimal change, duplicate this test in ltq-hcd.
    A better but more complex fix would be to call usb_hcd_link_urb_to_ep,
    usb_hcd_unlink_urb_from_ep and likely usb_hcd_check_unlink_urb; and to check
    for prerequisites (interrupts must be disabled).
    ---
     package/kernel/lantiq/ltq-hcd/src/ifxhcd.c | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/package/kernel/lantiq/ltq-hcd/src/ifxhcd.c b/package/kernel/lantiq/ltq-hcd/src/ifxhcd.c
    index be0a91d..b1d2b5e 100644
    a b int ifxhcd_urb_enqueue( struct usb_hcd *_syshcd, 
    901901                        dump_urb_info(_urb, "ifxusb_hcd_urb_enqueue"); 
    902902        #endif //__DEBUG__ 
    903903 
     904        if (atomic_read(&_urb->reject)) 
     905                return -EPERM; 
     906 
    904907        if (!ifxhcd->flags.b.port_connect_status)  /* No longer connected. */ 
    905908                return -ENODEV; 
    906909