All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend] module: propagate error in modules_open()
@ 2018-03-06 15:16 Leon Yu
  2018-03-08 13:12 ` Jessica Yu
  0 siblings, 1 reply; 2+ messages in thread
From: Leon Yu @ 2018-03-06 15:16 UTC (permalink / raw)
  To: Jessica Yu, Linus Torvalds, linux-kernel; +Cc: Leon Yu, stable

otherwise kernel can oops later in seq_release() due to dereferencing null
file->private_data which is only set if seq_open() succeeds.

BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
IP: seq_release+0xc/0x30
Call Trace:
 close_pdeo+0x37/0xd0
 proc_reg_release+0x5d/0x60
 __fput+0x9d/0x1d0
 ____fput+0x9/0x10
 task_work_run+0x75/0x90
 do_exit+0x252/0xa00
 do_group_exit+0x36/0xb0
 SyS_exit_group+0xf/0x10

Fixes: 516fb7f2e73d ("/proc/module: use the same logic as /proc/kallsyms for address exposure")
Cc: Jessica Yu <jeyu@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: stable@vger.kernel.org # 4.15+
Signed-off-by: Leon Yu <chianglungyu@gmail.com>
---
 kernel/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index ad2d420024f6..e42764acedb4 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -4228,7 +4228,7 @@ static int modules_open(struct inode *inode, struct file *file)
 		m->private = kallsyms_show_value() ? NULL : (void *)8ul;
 	}
 
-	return 0;
+	return err;
 }
 
 static const struct file_operations proc_modules_operations = {
--
2.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH resend] module: propagate error in modules_open()
  2018-03-06 15:16 [PATCH resend] module: propagate error in modules_open() Leon Yu
@ 2018-03-08 13:12 ` Jessica Yu
  0 siblings, 0 replies; 2+ messages in thread
From: Jessica Yu @ 2018-03-08 13:12 UTC (permalink / raw)
  To: Leon Yu; +Cc: Linus Torvalds, linux-kernel, stable

+++ Leon Yu [06/03/18 23:16 +0800]:
>otherwise kernel can oops later in seq_release() due to dereferencing null
>file->private_data which is only set if seq_open() succeeds.
>
>BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
>IP: seq_release+0xc/0x30
>Call Trace:
> close_pdeo+0x37/0xd0
> proc_reg_release+0x5d/0x60
> __fput+0x9d/0x1d0
> ____fput+0x9/0x10
> task_work_run+0x75/0x90
> do_exit+0x252/0xa00
> do_group_exit+0x36/0xb0
> SyS_exit_group+0xf/0x10
>
>Fixes: 516fb7f2e73d ("/proc/module: use the same logic as /proc/kallsyms for address exposure")
>Cc: Jessica Yu <jeyu@kernel.org>
>Cc: Linus Torvalds <torvalds@linux-foundation.org>
>Cc: stable@vger.kernel.org # 4.15+
>Signed-off-by: Leon Yu <chianglungyu@gmail.com>

Ah yeah, the error code was dropped in that commit. 

Applied, thanks for the fix.

Jessica

>---
> kernel/module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/kernel/module.c b/kernel/module.c
>index ad2d420024f6..e42764acedb4 100644
>--- a/kernel/module.c
>+++ b/kernel/module.c
>@@ -4228,7 +4228,7 @@ static int modules_open(struct inode *inode, struct file *file)
> 		m->private = kallsyms_show_value() ? NULL : (void *)8ul;
> 	}
>
>-	return 0;
>+	return err;
> }
>
> static const struct file_operations proc_modules_operations = {
>--
>2.16.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-08 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 15:16 [PATCH resend] module: propagate error in modules_open() Leon Yu
2018-03-08 13:12 ` Jessica Yu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.