mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 21:15:53 +02:00
nvmet-tcp: fix a memory leak when releasing a queue
[ Upstream commit 926245c7d2 ]
page_frag_free() won't completely release the memory
allocated for the commands, the cache page must be explicitly
freed by calling __page_frag_cache_drain().
This bug can be easily reproduced by repeatedly
executing the following command on the initiator:
$echo 1 > /sys/devices/virtual/nvme-fabrics/ctl/nvme0/reset_controller
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: John Meneghini <jmeneghi@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0e86b727a9
commit
db1d9d102e
|
|
@ -1398,6 +1398,7 @@ static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
|
||||||
|
|
||||||
static void nvmet_tcp_release_queue_work(struct work_struct *w)
|
static void nvmet_tcp_release_queue_work(struct work_struct *w)
|
||||||
{
|
{
|
||||||
|
struct page *page;
|
||||||
struct nvmet_tcp_queue *queue =
|
struct nvmet_tcp_queue *queue =
|
||||||
container_of(w, struct nvmet_tcp_queue, release_work);
|
container_of(w, struct nvmet_tcp_queue, release_work);
|
||||||
|
|
||||||
|
|
@ -1417,6 +1418,8 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
|
||||||
nvmet_tcp_free_crypto(queue);
|
nvmet_tcp_free_crypto(queue);
|
||||||
ida_simple_remove(&nvmet_tcp_queue_ida, queue->idx);
|
ida_simple_remove(&nvmet_tcp_queue_ida, queue->idx);
|
||||||
|
|
||||||
|
page = virt_to_head_page(queue->pf_cache.va);
|
||||||
|
__page_frag_cache_drain(page, queue->pf_cache.pagecnt_bias);
|
||||||
kfree(queue);
|
kfree(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user