Commit bfabb65
nvmet-tcp: Ensure old keys are freed before replacing new ones
Previously after the host sends a REPLACETLSPSK we freed the TLS keys as
part of calling nvmet_auth_sq_free() on success. A recent change ensured
we don't free the keys, allowing REPLACETLSPSK to work.
But that fix results in a kernel memory leak when running
```
nvme_trtype=loop ./check nvme/041 nvme/042 nvme/043 nvme/044 nvme/045 nvme/051 nvme/052
echo scan > /sys/kernel/debug/kmemleak
cat /sys/kernel/debug/kmemleak
```
We can't free the keys on a successful DHCHAP operation, otherwise the
next REPLACETLSPSK will fail, so instead let's free them before we
replace them as part of nvmet_auth_challenge().
This ensures that REPLACETLSPSK works, while also avoiding any memory
leaks.
Fixes: 2e6eb6b ("nvmet-tcp: Don't free SQ on authentication success")
Signed-off-by: Alistair Francis <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>1 parent ceec5ed commit bfabb65
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
415 | 422 | | |
416 | 423 | | |
417 | 424 | | |
| |||
0 commit comments