BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: David CARLIER <devnexen@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 1/1]
Date: Thu, 23 Jan 2025 18:16:54 -0800	[thread overview]
Message-ID: <a36556ee79898a0ccfaec42e1c70ba5593b1887f.camel@gmail.com> (raw)
In-Reply-To: <CA+XhMqyt7LGkitBrNE1goRMQdsP23=BwLsCor0pY+mM6zO2+zg@mail.gmail.com>

On Tue, 2025-01-21 at 16:50 +0000, David CARLIER wrote:
> libbpf.c memory leaks fixes proposal.

Hi David,

please take a look at the documentation regarding sending kernel patches:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html
In particular:
- the email should be in plain text
- subject should be present
- the patch itself is a part of the email, not an attachment.

About the change itself, why do you think there is a resource leak?
Here is a fragment of bpf_program__attach_kprobe_opts:

	link = bpf_program__attach_perf_event_opts(prog, pfd, &pe_opts);
	err = libbpf_get_error(link);
	if (err) {
-		close(pfd);
+		bpf_link__destroy(link);
		pr_warn("prog '%s': failed to attach to %s '%s+0x%zx': %s\n",
			prog->name, retprobe ? "kretprobe" : "kprobe",
			func_name, offset,
			errstr(err));
		goto err_clean_legacy;
	}

When libbpf_get_error returns a non-zero value the `link`
is either an error value or null, so bpf_link__destroy
has nothing to work with.

  parent reply	other threads:[~2025-01-24  2:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-21 16:50 [PATCH bpf-next 1/1] David CARLIER
2025-01-21 19:41 ` Ihor Solodrai
2025-01-24  2:16 ` Eduard Zingerman [this message]
2025-01-24  7:13   ` David CARLIER

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=a36556ee79898a0ccfaec42e1c70ba5593b1887f.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=devnexen@gmail.com \
    /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