]> git.baikalelectronics.ru Git - kernel.git/commit
net/9p: validate fds in p9_fd_open
authorChristoph Hellwig <hch@lst.de>
Fri, 10 Jul 2020 08:57:22 +0000 (10:57 +0200)
committerDominique Martinet <asmadeus@codewreck.org>
Sun, 19 Jul 2020 12:58:29 +0000 (14:58 +0200)
commit2dd02538964bb77e73ee866e0a768f93e65eb39f
tree3a1695a936e75161787df3a635ef3f474d5a7b83
parent7daaaab6ddfd73fcb75b364ef4d2282d11779150
net/9p: validate fds in p9_fd_open

p9_fd_open just fgets file descriptors passed in from userspace, but
doesn't verify that they are valid for read or writing.  This gets
cought down in the VFS when actually attempting a read or write, but
a new warning added in linux-next upsets syzcaller.

Fix this by just verifying the fds early on.

Link: http://lkml.kernel.org/r/20200710085722.435850-1-hch@lst.de
Reported-by: syzbot+e6f77e16ff68b2434a2c@syzkaller.appspotmail.com
Signed-off-by: Christoph Hellwig <hch@lst.de>
[Dominique: amend goto as per Doug Nazar's review]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
net/9p/trans_fd.c