Skip to content

Commit

Permalink
nvme-fc: Prevent null pointer dereference in nvme_fc_io_getuuid()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nigel Kirkland authored and Keith Busch committed Aug 21, 2023
1 parent 71be868 commit 8ae5b3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/nvme/host/fc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req)
struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req);
struct request *rq = op->rq;

if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio)
if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq || !rq->bio)
return NULL;
return blkcg_get_fc_appid(rq->bio);
}
Expand Down

0 comments on commit 8ae5b3a

Please sign in to comment.