Skip to content

Commit 8f6363c

Browse files
bryamzxzgregkh
authored andcommitted
nvmet-auth: zero the AUTH_RECEIVE response buffer
commit 3ddcfb0 upstream. nvmet_execute_auth_receive() allocates the response buffer with kmalloc() sized by the host-supplied AUTH_RECEIVE allocation length, but the DH-HMAC-CHAP builders write only a fixed-size message into it. The full allocation length is then copied to the wire by nvmet_copy_to_sgl(), so a remote initiator receives the bytes past the built message -- up to nearly a page of uninitialized slab -- during the pre-authentication handshake. Allocate the buffer with kzalloc() so the unwritten tail is zeroed before it is sent; conforming responses are unaffected. Fixes: db1312d ("nvmet: implement basic In-Band Authentication") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas <hexlabsecurity@proton.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 087ee0d commit 8f6363c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/nvme/target/fabrics-cmd-auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
475475
return;
476476
}
477477

478-
d = kmalloc(al, GFP_KERNEL);
478+
d = kzalloc(al, GFP_KERNEL);
479479
if (!d) {
480480
status = NVME_SC_INTERNAL;
481481
goto done;

0 commit comments

Comments
 (0)