Skip to content

Commit 3146345

Browse files
igawkeithbusch
authored andcommitted
nvmet-fc: abort command when there is no binding
When the target port has not active port binding, there is no point in trying to process the command as it has to fail anyway. Instead adding checks to all commands abort the command early. Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Daniel Wagner <dwagner@suse.de> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 1c11058 commit 3146345

File tree

1 file changed

+6
-2
lines changed
  • drivers/nvme/target

1 file changed

+6
-2
lines changed

drivers/nvme/target/fc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,9 @@ nvmet_fc_alloc_target_assoc(struct nvmet_fc_tgtport *tgtport, void *hosthandle)
10991099
int idx;
11001100
bool needrandom = true;
11011101

1102+
if (!tgtport->pe)
1103+
return NULL;
1104+
11021105
assoc = kzalloc(sizeof(*assoc), GFP_KERNEL);
11031106
if (!assoc)
11041107
return NULL;
@@ -2514,8 +2517,9 @@ nvmet_fc_handle_fcp_rqst(struct nvmet_fc_tgtport *tgtport,
25142517

25152518
fod->req.cmd = &fod->cmdiubuf.sqe;
25162519
fod->req.cqe = &fod->rspiubuf.cqe;
2517-
if (tgtport->pe)
2518-
fod->req.port = tgtport->pe->port;
2520+
if (!tgtport->pe)
2521+
goto transport_error;
2522+
fod->req.port = tgtport->pe->port;
25192523

25202524
/* clear any response payload */
25212525
memset(&fod->rspiubuf, 0, sizeof(fod->rspiubuf));

0 commit comments

Comments
 (0)