diff options
author | Ming Lei <ming.lei@redhat.com> | 2021-06-02 21:30:27 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-06-07 22:12:44 -0400 |
commit | 3719f4ff047e20062b8314c23ec3cab84d74c908 (patch) | |
tree | b1311fbdbf55aa87c1cbdad6613d72d47526edee /drivers/virt | |
parent | 66a834d092930cf41d809c0e989b13cd6f9ca006 (diff) |
scsi: core: Fix failure handling of scsi_add_host_with_dma()
When scsi_add_host_with_dma() returns failure, the caller will call
scsi_host_put(shost) to release everything allocated for this host
instance. Consequently we can't also free allocated stuff in
scsi_add_host_with_dma(), otherwise we will end up with a double free.
Strictly speaking, host resource allocations should have been done in
scsi_host_alloc(). However, the allocations may need information which is
not yet provided by the driver when that function is called. So leave the
allocations where they are but rely on host device's release handler to
free resources.
Link: https://lore.kernel.org/r/20210602133029.2864069-3-ming.lei@redhat.com
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Hannes Reinecke <hare@suse.de>
Tested-by: John Garry <john.garry@huawei.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: John Garry <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/virt')
0 files changed, 0 insertions, 0 deletions