From: Florian Westphal <fw@strlen.de>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: Florian Westphal <fw@strlen.de>,
Chenyuan Yang <chenyuan0y@gmail.com>,
netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: Initialize ctx to avoid memory allocation error
Date: Fri, 14 Mar 2025 21:30:44 +0100 [thread overview]
Message-ID: <20250314203044.GA9537@breakpoint.cc> (raw)
In-Reply-To: <d2019823-4500-499a-8368-76c50a582f47@schaufler-ca.com>
Casey Schaufler <casey@schaufler-ca.com> wrote:
> >>> seclen needs to be > 0 or no secinfo is passed to userland,
> >>> yet the secctx release function is called anyway.
> >> That is correct. The security module is responsible for handling
> >> the release of secctx correctly.
> >>
> >>> Should seclen be initialised to -1? Or we need the change below too?
> >> No. The security modules handle secctx their own way.
> > Well, as-is security_release_secctx() can be called with garbage ctx;
> > seclen is inited to 0, but ctx is not initialized unconditionally.
>
> Which isn't an issue for any existing security module.
The splat quoted in
35fcac7a7c25 ("audit: Initialize lsmctx to avoid memory allocation error")
seems to disagree. I see no difference to what nfnetlink_queue is
doing.
next prev parent reply other threads:[~2025-03-14 20:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 19:54 [PATCH] net: Initialize ctx to avoid memory allocation error Chenyuan Yang
2025-03-13 20:10 ` Florian Westphal
2025-03-14 16:41 ` Casey Schaufler
2025-03-14 16:47 ` Florian Westphal
2025-03-14 17:26 ` Casey Schaufler
2025-03-14 20:30 ` Florian Westphal [this message]
2025-03-15 18:34 ` Casey Schaufler
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=20250314203044.GA9537@breakpoint.cc \
--to=fw@strlen.de \
--cc=casey@schaufler-ca.com \
--cc=chenyuan0y@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.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).