nvmet-trace: avoid dereferencing pointer too early
authorDaniel Wagner <dwagner@suse.de>
Mon, 18 Dec 2023 15:30:51 +0000 (16:30 +0100)
committerKeith Busch <kbusch@kernel.org>
Wed, 3 Jan 2024 16:09:41 +0000 (08:09 -0800)
commit0e716cec6fb11a14c220ee17c404b67962e902f7
treefa7063d6d6fc5930e441a16726ca0cc3d7ae6397
parent72e8c9379dbef2662c2479c3d142e4c44d598a5b
nvmet-trace: avoid dereferencing pointer too early

The first command issued from the host to the target is the fabrics
connect command. At this point, neither the target queue nor the
controller have been allocated. But we already try to trace this command
in nvmet_req_init.

Reported by KASAN.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/trace.c
drivers/nvme/target/trace.h