• Andrey Rusalin's avatar
    NFC: pn533: change order operations in dev registation · 32ecc75d
    Andrey Rusalin authored
    Sometimes during probing and registration of pn533_i2c
    NULL pointer dereference happens.
    Reproduced in cycle of inserting and removing pn533_i2c
    and pn533 modules.
    
    Backtrace:
    [<8004205c>] (__queue_work) from [<80042324>] (queue_work_on+0x50/0x5c)
    r10:acdc7c80 r9:8006b330 r8:ac0dfb40 r7:ac50c600 r6:00000004 r5:acbbee40 r4:600f0113
    [<800422d4>] (queue_work_on) from [<7f7d5b6c>] (pn533_recv_frame+0x158/0x1fc [pn533])
    r7:ffffff87 r6:00000000 r5:acbbee40 r4:acbbee00
    [<7f7d5a14>] (pn533_recv_frame [pn533]) from [<7f7df4b8>] (pn533_i2c_irq_thread_fn+0x184/0x)
    r6:acb2a000 r5:00000000 r4:acdc7b90
    [<7f7df334>] (pn533_i2c_irq_thread_fn [pn533_i2c]) from [<8006b354>] (irq_thread_fn+0x24/0x)
    r7:00000000 r6:accde000 r5:ac0dfb40 r4:acdc7c80
    ...
    
    Seems there is some race condition due registration of
    irq handler until all data stuctures that could be needed
    are ready. So I re-ordered some ops. After this, problem has gone.
    
    Changes in USB part was not tested, but it should not break
    anything.
    Signed-off-by: default avatarAndrey Rusalin <arusalin@dev.rtsoft.ru>
    Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
    32ecc75d
usb.c 14.3 KB