[lkml]   [2012]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] fix NULL-pointer dereference on scsi_run_queue
    On 08/07/12 08:53, Chanho Min wrote:
    > On Tue, Aug 7, 2012 at 2:56 AM, Bart Van Assche <> wrote:
    >> Indeed. How about the patch below ? Scsi devices are removed from
    >> starved_list after blk_cleanup_queue() and before put_device(). That
    >> guarantees that inside scsi_run_queue() get_device() under host lock
    >> will succeed.
    > Thanks, IMHO, it's harmless and the simple way to solve this issue.
    > But, I think the second half of your patches are not required, extra
    > referecne is might suffice?

    I'm afraid that without the second half of that patch the following race
    is still possible:
    - sdev reference count drops to zero while scsi_run_queue() is in
    progress and while that sdev is on the starved_list of its SCSI host;
    scsi_device_dev_release_usercontext() call is scheduled but not yet
    - scsi_run_queue() takes that sdev off the local starved_list.
    - scsi_run_queue() calls get_device() and that call fails since the
    sdev reference count is zero.
    - scsi_device_dev_release_usercontext() gets scheduled and frees the
    - scsi_run_queue() proceeds and calls __blk_run_queue() on a freed
    queue, which is what we were trying to avoid.


     \ /
      Last update: 2012-08-07 12:01    [W:0.042 / U:32.344 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site