mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
nvmet: prevent double-free after metadata SGL allocation failure
If metadata SGL allocation fails, nvmet_req_alloc_sgls() frees
req->sg without clearing it. The RDMA error completion path later
frees the same scatterlist again.
Use nvmet_req_free_sgls() instead so that the scatterlist pointers
and counts are cleared before response cleanup.
Fixes: c6e3f13398 ("nvmet: add metadata support for block devices")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
9fb4adbc39
commit
2f61b9d1d5
|
|
@ -1357,7 +1357,7 @@ int nvmet_req_alloc_sgls(struct nvmet_req *req)
|
|||
|
||||
return 0;
|
||||
out_free:
|
||||
sgl_free(req->sg);
|
||||
nvmet_req_free_sgls(req);
|
||||
out:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user