DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: skori@marvell.com
Cc: jerinj@marvell.com, dev@dpdk.org, stable@dpdk.org,
	Weiguo Li <liweiguo@xencore.cn>
Subject: [PATCH] examples/l3fwd: fix missing unlock issue
Date: Sat,  4 Nov 2023 15:27:37 +0800	[thread overview]
Message-ID: <tencent_221F3CE2A7B111333A16DF62235322503108@qq.com> (raw)

The function l3fwd_get_free_event_port acquires a lock on
'evt_rsrc->evp.lock' at the beginning. This lock is expected
to be released at the first return statement, when no free
event port is available.

Fixes: aaf58cb85b62 ("examples/l3fwd: add event port and queue setup")
Cc: stable@dpdk.org

Signed-off-by: Weiguo Li <liweiguo@xencore.cn>
---
 examples/l3fwd/l3fwd_event.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
index 20be22c6db..40c69baafb 100644
--- a/examples/l3fwd/l3fwd_event.c
+++ b/examples/l3fwd/l3fwd_event.c
@@ -205,6 +205,7 @@ l3fwd_get_free_event_port(struct l3fwd_event_resources *evt_rsrc)
 
 	rte_spinlock_lock(&evt_rsrc->evp.lock);
 	if (index >= evt_rsrc->evp.nb_ports) {
+		rte_spinlock_unlock(&evt_rsrc->evp.lock);
 		printf("No free event port is available\n");
 		return -1;
 	}
-- 
2.34.1


                 reply	other threads:[~2023-11-04  7:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_221F3CE2A7B111333A16DF62235322503108@qq.com \
    --to=liwg06@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=liweiguo@xencore.cn \
    --cc=skori@marvell.com \
    --cc=stable@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).