From: bot+bpf-ci@kernel.org
To: malayarout91@gmail.com,linux-kernel@vger.kernel.org,bpf@vger.kernel.org
Cc: mrout@redhat.com,skhan@linuxfoundation.org,me@brighamcampbell.com,malayarout91@gmail.com,andrii@kernel.org,eddyz87@gmail.com,ast@kernel.org,daniel@iogearbox.net,memxor@gmail.com,martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,shuah@kernel.org,john.fastabend@gmail.com,linux-kselftest@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH] selftests/bpf: Fix memory leak in msg_alloc_iov error path
Date: Sat, 4 Jul 2026 11:47:07 +0000 (UTC) [thread overview]
Message-ID: <7f3e0f9992a32264f6c7cf00f2ef3ce87a0a6fbd6703084aff3de68cda77dc9c@mail.kernel.org> (raw)
In-Reply-To: <20260704111016.95816-1-malayarout91@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]
> selftests/bpf: Fix memory leak in msg_alloc_iov error path
>
> In msg_alloc_iov(), when calloc() fails for an individual iov_base
> allocation, the error path frees all previously allocated iov_base
> entries but fails to free the iov array itself that was allocated
> with calloc() at the beginning of the function. This results in a
> memory leak of the iov array.
>
> Add free(iov) in the unwind_iov error path to ensure proper cleanup
> of all allocated memory.
>
> Fixes: 16962b2404ac ("bpf: sockmap, add selftests")
> Signed-off-by: Malaya Kumar Rout <malayarout91@gmail.com>
Is the Fixes: tag pointing at the right commit?
In 16962b2404ac ("bpf: sockmap, add selftests") the iov allocation lived
inside msg_loop(), and its out_errno error path already freed the iov
array with free(iov). There was no msg_alloc_iov() helper and no
unwind_iov label at that point.
The leaking unwind_iov path was introduced later, when the allocation was
refactored into the new msg_alloc_iov() helper whose unwind_iov label
frees each iov_base entry but omits free(iov). Would this be a better
match?
Fixes: 753fb2ee0934 ("bpf: sockmap, add msg_peek tests to test_sockmap")
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/28704662518
next prev parent reply other threads:[~2026-07-04 11:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 11:10 Malaya Kumar Rout
2026-07-04 11:47 ` bot+bpf-ci [this message]
2026-07-04 12:29 ` [PATCH v2] " Malaya Kumar Rout
2026-07-06 16:04 ` Emil Tsalapatis
2026-07-06 19:30 ` patchwork-bot+netdevbpf
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=7f3e0f9992a32264f6c7cf00f2ef3ce87a0a6fbd6703084aff3de68cda77dc9c@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=malayarout91@gmail.com \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=me@brighamcampbell.com \
--cc=memxor@gmail.com \
--cc=mrout@redhat.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®