• Anton Vorontsov's avatar
    USB: fsl_udc_core: Fix kernel oops on module removal · 37c4fd8c
    Anton Vorontsov authored
    fsl_udc_release() calls dma_free_coherent() with an inappropriate
    device passed to it, and since the device has no dma_ops, the following
    oops pops up:
    
      Kernel BUG at d103ce9c [verbose debug info unavailable]
      Oops: Exception in kernel mode, sig: 5 [#1]
      ...
      NIP [d103ce9c] fsl_udc_release+0x50/0x80 [fsl_usb2_udc]
      LR [d103ce74] fsl_udc_release+0x28/0x80 [fsl_usb2_udc]
      Call Trace:
      [cfbc7dc0] [d103ce74] fsl_udc_release+0x28/0x80 [fsl_usb2_udc]
      [cfbc7dd0] [c01a35c4] device_release+0x2c/0x90
      [cfbc7de0] [c016b480] kobject_cleanup+0x58/0x98
      [cfbc7e00] [c016c52c] kref_put+0x54/0x6c
      [cfbc7e10] [c016b360] kobject_put+0x34/0x64
      [cfbc7e20] [c01a1d0c] put_device+0x1c/0x2c
      [cfbc7e30] [d103dbfc] fsl_udc_remove+0xc0/0x1e4 [fsl_usb2_udc]
      ...
    
    This patch fixes the issue by passing dev->parent, which points to
    a correct device.
    Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
    Cc: Li Yang <leoli@freescale.com>
    Cc: David Brownell <dbrownell@users.sourceforge.net>
    Cc: Guennadi Liakhovetski <lg@denx.de>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    37c4fd8c
fsl_udc_core.c 65.1 KB