mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
nvmet-auth: zero the AUTH_RECEIVE response buffer
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: db1312dd95 ("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>
This commit is contained in:
parent
3a6d89836a
commit
3ddcfb0133
|
|
@ -558,7 +558,7 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
|
|||
return;
|
||||
}
|
||||
|
||||
d = kmalloc(al, GFP_KERNEL);
|
||||
d = kzalloc(al, GFP_KERNEL);
|
||||
if (!d) {
|
||||
status = NVME_SC_INTERNAL;
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user