Skip to content

Commit 8ae5b3a

Browse files
Nigel Kirklandkeithbusch
authored andcommitted
nvme-fc: Prevent null pointer dereference in nvme_fc_io_getuuid()
The nvme_fc_fcp_op structure describing an AEN operation is initialized with a null request structure pointer. An FC LLDD may make a call to nvme_fc_io_getuuid passing a pointer to an nvmefc_fcp_req for an AEN operation. Add validation of the request structure pointer before dereference. Signed-off-by: Nigel Kirkland <nkirkland2304@gmail.com> Reviewed-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 71be868 commit 8ae5b3a

File tree

1 file changed

+1
-1
lines changed
  • drivers/nvme/host

1 file changed

+1
-1
lines changed

drivers/nvme/host/fc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,7 @@ char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)
19241924
struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req);
19251925
struct request *rq = op->rq;
19261926

1927-
if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio)
1927+
if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq || !rq->bio)
19281928
return NULL;
19291929
return blkcg_get_fc_appid(rq->bio);
19301930
}

0 commit comments

Comments
 (0)