• Mike Christie's avatar
    [SCSI] scsi_host regression: fix scsi host leak · 3ed78972
    Mike Christie authored
    commit 9c770108
    Author: Dave Young <hidave.darkstar@gmail.com>
    Date:   Tue Jan 22 14:01:34 2008 +0800
    
        scsi: use class iteration api
    
    Isn't a correct replacement for the original hand rolled host
    lookup. The problem is that class_find_child would get a reference to
    the host's class device which is never released.  Since the host class
    device holds a reference to the host gendev, the host can never be
    freed.
    
    In 2.6.26 we started using class_find_device, and this function also
    gets a reference to the device, so we end up with an extra ref
    and the host will not get released.
    
    This patch adds a put_device to balance the class_find_device() get. I
    kept the scsi_host_get in scsi_host_lookup, because the target layer
    is using scsi_host_lookup and it looks like it needs the SHOST_DEL
    check.
    Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    3ed78972
hosts.c 13.1 KB