DPDK patches and discussions
 help / color / mirror / Atom feed
From: <eagostini@nvidia.com>
To: <dev@dpdk.org>
Cc: Elena Agostini <eagostini@nvidia.com>
Subject: [PATCH v1] gpu/cuda: fix memory list cleanup
Date: Tue, 21 Dec 2021 20:50:42 +0000	[thread overview]
Message-ID: <20211221205042.17289-1-eagostini@nvidia.com> (raw)

From: Elena Agostini <eagostini@nvidia.com>

Memory list cleanup (called by cuda_mem_free)
was not properly set the new head of the list
when deleting an entry.

Fixes: 1306a73b1958 ("gpu/cuda: introduce CUDA driver")

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
---
 drivers/gpu/cuda/cuda.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/cuda/cuda.c b/drivers/gpu/cuda/cuda.c
index 49da215af4..afd4b92a93 100644
--- a/drivers/gpu/cuda/cuda.c
+++ b/drivers/gpu/cuda/cuda.c
@@ -447,9 +447,11 @@ mem_list_del_item(cuda_ptr_key pk)
 		return -EINVAL;
 
 	/* if key is in head */
-	if (mem_alloc_list_cur->prev == NULL)
+	if (mem_alloc_list_cur->prev == NULL) {
 		mem_alloc_list_head = mem_alloc_list_cur->next;
-	else {
+		if (mem_alloc_list_head != NULL)
+			mem_alloc_list_head->prev = NULL;
+	} else {
 		mem_alloc_list_cur->prev->next = mem_alloc_list_cur->next;
 		if (mem_alloc_list_cur->next != NULL)
 			mem_alloc_list_cur->next->prev = mem_alloc_list_cur->prev;
-- 
2.17.1


             reply	other threads:[~2021-12-21 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 20:50 eagostini [this message]
2022-01-20 13:15 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211221205042.17289-1-eagostini@nvidia.com \
    --to=eagostini@nvidia.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).