Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails

scsi_host_alloc() not only allocates memory for a SCSI host but also
creates the scsi_eh_<n> kernel thread and the scsi_tmf_<n> workqueue.
Stop these threads if login fails by calling scsi_host_put().

Reported-by: Konstantin Krotov <kkv@clodo.ru>
Fixes: fb49c8bbaae7 ("Remove an extraneous scsi_host_put() from an error path")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Cc: <stable@vger.kernel.org> #v3.19
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Bart Van Assche and committed by
Doug Ledford
bc44bd1d 713ef24e

+9
+9
drivers/infiniband/ulp/srp/ib_srp.c
··· 2758 2758 return c; 2759 2759 } 2760 2760 2761 + /* 2762 + * Return values: 2763 + * < 0 upon failure. Caller is responsible for SRP target port cleanup. 2764 + * 0 and target->state == SRP_TARGET_REMOVED if asynchronous target port 2765 + * removal has been scheduled. 2766 + * 0 and target->state != SRP_TARGET_REMOVED upon success. 2767 + */ 2761 2768 static int srp_add_target(struct srp_host *host, struct srp_target_port *target) 2762 2769 { 2763 2770 struct srp_rport_identifiers ids; ··· 3303 3296 mutex_unlock(&host->add_target_mutex); 3304 3297 3305 3298 scsi_host_put(target->scsi_host); 3299 + if (ret < 0) 3300 + scsi_host_put(target->scsi_host); 3306 3301 3307 3302 return ret; 3308 3303