diff options
| author | Guixin Liu <kanie@linux.alibaba.com> | 2026-10-28 16:55:51 +0800 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-10-28 08:25:37 -0700 |
| commit | 5c279fcabb0ea7ba61881c13027b15d8054b8abd (patch) | |
| tree | 493d8f8421e0c119d1f4871edd828f28aba5da18 /tools/lib/python | |
| parent | 18fc5f6f1ca945630dae5404265de55d65194e22 (diff) | |
nvmet: Free the old negotiation state when restarting authentication
Restarting a DH-HMAC-CHAP negotiation with SEND(NEGOTIATE) resets
sq->dhchap_step but does not release the previous c1/c2/skey, which
are only freed in nvmet_auth_sq_free() at teardown. The next
CHALLENGE/REPLY exchange then overwrites those pointers with fresh
allocations.
An unauthenticated host can repeat the negotiate message endlessly,
leaking a few dozen bytes per round and slowly exhausting target
memory.
Clear the old negotiation state with nvmet_auth_sq_free() before
setting up the new one. Also reset dhchap_skey_len to zero: if a DH
session key was already established, a following round with dhvlen=0
would otherwise pass a NULL skey with a stale non-zero length to the
HMAC code and dereference it.
Fixes: db1312dd95488 ("nvmet: implement basic In-Band Authentication")
Cc: stable@vger.kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
