From: Gaosheng Cui <cuigaosheng1@huawei.com>
To: <paul@paul-moore.com>, <eparis@redhat.com>, <cuigaosheng1@huawei.com>
Cc: <audit@vger.kernel.org>
Subject: [PATCH -next] audit: let the caller of audit_get_sk() ensure that net is valid
Date: Fri, 17 Mar 2023 11:37:33 +0800 [thread overview]
Message-ID: <20230317033733.1450702-1-cuigaosheng1@huawei.com> (raw)
The caller of audit_get_sk() must ensure that net is valid, otherwise
there will be null-prt-defer, for example, in the netlink_unicast().
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
kernel/audit.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index 9bc0b0301198..6a42a3801d01 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -285,16 +285,13 @@ static pid_t auditd_pid_vnr(void)
* @net: the destination network namespace
*
* Description:
- * Returns the sock pointer if valid, NULL otherwise. The caller must ensure
- * that a reference is held for the network namespace while the sock is in use.
+ * Returns the sock pointer. The caller must ensure than net is valid and
+ * a reference is held for the network namespace while the sock is in use.
*/
static struct sock *audit_get_sk(const struct net *net)
{
struct audit_net *aunet;
- if (!net)
- return NULL;
-
aunet = net_generic(net, audit_net_id);
return aunet->sk;
}
--
2.25.1
next reply other threads:[~2023-03-17 3:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-17 3:37 Gaosheng Cui [this message]
2023-03-23 15:40 ` [PATCH -next] audit: let the caller of audit_get_sk() ensure that net is valid Paul Moore
2023-03-24 2:31 ` cuigaosheng
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=20230317033733.1450702-1-cuigaosheng1@huawei.com \
--to=cuigaosheng1@huawei.com \
--cc=audit@vger.kernel.org \
--cc=eparis@redhat.com \
--cc=paul@paul-moore.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;
as well as URLs for NNTP newsgroup(s).