• Sumit.Saxena@avagotech.com's avatar
    megaraid_sas : MFI MPT linked list corruption fix · 90dc9d98
    Sumit.Saxena@avagotech.com authored
    Resending the patch. Addressed the review comments from Tomas Henzl.
    Added comment for to-do work.
    
    Problem statement:
    MFI link list in megaraid_sas driver is used from mfi-mpt pass-through commands.
    This list can be corrupted due to many possible race conditions in driver and
    eventually we may see kernel panic.
    
    One example -
    MFI frame is freed from calling process as driver send command via polling method and interrupt
    for that command comes after driver free mfi frame (actually even after some other context reuse
    the mfi frame). When driver receive MPT frame in ISR, driver will be using the index of MFI and
    access that MFI frame and finally in-used MFI frame’s list will be corrupted.
    
    High level description of new solution -
    Free MFI and MPT command from same context.
    Free both the command either from process (from where mfi-mpt pass-through was called) or from
    ISR context. Do not split freeing of MFI and MPT, because it creates the race condition which
    will do MFI/MPT list corruption.
    
    Renamed the cmd_pool_lock which is used in instance as well as fusion with below name.
    mfi_pool_lock and mpt_pool_lock to add more code readability.
    Signed-off-by: default avatarSumit Saxena <sumit.saxena@avagotech.com>
    Signed-off-by: default avatarKashyap Desai <kashyap.desai@avagotech.com>
    Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    90dc9d98
megaraid_sas_base.c 182 KB