Skip to content

Commit 3f553b3

Browse files
clyuJessica Yu
authored andcommitted
module: propagate error in modules_open()
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: 516fb7f ("/proc/module: use the same logic as /proc/kallsyms for address exposure") Cc: Jessica Yu <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: [email protected] # 4.15+ Signed-off-by: Leon Yu <[email protected]> Signed-off-by: Jessica Yu <[email protected]>
1 parent 661e50b commit 3f553b3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4228,7 +4228,7 @@ static int modules_open(struct inode *inode, struct file *file)
42284228
m->private = kallsyms_show_value() ? NULL : (void *)8ul;
42294229
}
42304230

4231-
return 0;
4231+
return err;
42324232
}
42334233

42344234
static const struct file_operations proc_modules_operations = {

0 commit comments

Comments
 (0)