lkml.org 
[lkml]   [2018]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/6] vfs: Fix fs_context logging when there's no log
From
Date
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
logfc().

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 <dhowells@redhat.com>
---

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;
\
 
 \ /
  Last update: 2018-08-21 11:56    [W:0.035 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site