Skip to content

Commit

Permalink
IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails
Browse files Browse the repository at this point in the history
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: fb49c8b ("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>
  • Loading branch information
Bart Van Assche authored and Doug Ledford committed Aug 30, 2015
1 parent 713ef24 commit bc44bd1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2758,6 +2758,13 @@ static int srp_sdev_count(struct Scsi_Host *host)
return c;
}

/*
* Return values:
* < 0 upon failure. Caller is responsible for SRP target port cleanup.
* 0 and target->state == SRP_TARGET_REMOVED if asynchronous target port
* removal has been scheduled.
* 0 and target->state != SRP_TARGET_REMOVED upon success.
*/
static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
{
struct srp_rport_identifiers ids;
Expand Down Expand Up @@ -3296,6 +3303,8 @@ static ssize_t srp_create_target(struct device *dev,
mutex_unlock(&host->add_target_mutex);

scsi_host_put(target->scsi_host);
if (ret < 0)
scsi_host_put(target->scsi_host);

return ret;

Expand Down

0 comments on commit bc44bd1

Please sign in to comment.