archive mirror
 help / color / mirror / Atom feed
From: David Howells <>
Subject: [PATCH 2/6] vfs: Fix fs_context logging when there's no log
Date: Tue, 21 Aug 2018 10:55:12 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

If an fs_context-based mount is called from mount(2) or some other place
that doesn't set up the logging-through-fd, then under some circumstances
an oops will occur due to the log being unconditionally accessed in

Fix this by checking whether there is a log structure before attempting to
access it

Fixes: 06b830edff9f ("vfs: Implement logging through fs_context")
Signed-off-by: David Howells <>

 fs/fs_context.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs_context.c b/fs/fs_context.c
index 14921b2c1e42..053b8d0f11ea 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -416,7 +416,7 @@ void logfc(struct fs_context *fc, const char *fmt, ...)
 	if ((unsigned long)p >= (unsigned long)__start_rodata &&
 	    (unsigned long)p <  (unsigned long)__end_rodata)
 		goto const_string;
-	if (within_module_core((unsigned long)p, log->owner))
+	if (log && within_module_core((unsigned long)p, log->owner))
 		goto const_string;
 	q = kstrdup(p, GFP_KERNEL);
 	goto copied_string;

  parent reply	other threads:[~2018-08-21  9:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  9:54 vfs: Fixes/adjustments for mount API stuff David Howells
2018-08-21  9:55 ` [PATCH 1/6] vfs: Fix vfs_dup_fs_context() David Howells
2018-08-21  9:55 ` David Howells [this message]
2018-08-21  9:55 ` [PATCH 3/6] afs: Move the source fs parameter to the first position David Howells
2018-08-21  9:55 ` [PATCH 4/6] vfs: Pass path info fsinfo and rename get_fsinfo sb op to fsinfo David Howells
2018-08-21  9:55 ` [PATCH 5/6] vfs: Adjust fsinfo sample output David Howells
2018-08-21  9:55 ` [PATCH 6/6] proc: Set correct userns for new proc super created by a new pid_namespace David Howells

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* 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).