diff options
author | Eric Biggers | 2018-01-31 09:49:18 +0100 |
---|---|---|
committer | Linus Torvalds | 2018-01-31 17:48:37 +0100 |
commit | c9cc8d01fb04117928830449388512a5047569c9 (patch) | |
tree | b7e97b68733d1ee57025aed05373041d5912853f /drivers/mfd/stm32-timers.c | |
parent | iversion: make inode_cmp_iversion{+raw} return bool instead of s64 (diff) | |
download | kernel-qcow2-linux-c9cc8d01fb04117928830449388512a5047569c9.tar.gz kernel-qcow2-linux-c9cc8d01fb04117928830449388512a5047569c9.tar.xz kernel-qcow2-linux-c9cc8d01fb04117928830449388512a5047569c9.zip |
devpts: fix error handling in devpts_mntget()
If devpts_ptmx_path() returns an error code, then devpts_mntget()
dereferences an ERR_PTR():
BUG: unable to handle kernel paging request at fffffffffffffff5
IP: devpts_mntget+0x13f/0x280 fs/devpts/inode.c:173
Fix it by returning early in the error paths.
Reproducer:
#define _GNU_SOURCE
#include <fcntl.h>
#include <sched.h>
#include <sys/ioctl.h>
#define TIOCGPTPEER _IO('T', 0x41)
int main()
{
for (;;) {
int fd = open("/dev/ptmx", 0);
unshare(CLONE_NEWNS);
ioctl(fd, TIOCGPTPEER, 0);
}
}
Fixes: 311fc65c9fb9 ("pty: Repair TIOCGPTPEER")
Reported-by: syzbot <syzkaller@googlegroups.com>
Cc: <stable@vger.kernel.org> # v4.13+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mfd/stm32-timers.c')
0 files changed, 0 insertions, 0 deletions