From 4b1862e4fc6967bf326107ac0d5695157f32c25d Mon Sep 17 00:00:00 2001 From: Tadeusz Struk Date: Mon, 3 Jan 2022 12:50:26 -0800 Subject: [PATCH] ANDROID: incremental-fs: fix GPF in pending_reads_dispatch_ioctl It is possible that fget returns NULL. This needs to be handled correctly in ioctl_permit_fill. Bug: 212821226 Signed-off-by: Tadeusz Struk Change-Id: Iec8be21982afeab6794b78ab1a542671c52acea2 --- fs/incfs/pseudo_files.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/incfs/pseudo_files.c b/fs/incfs/pseudo_files.c index 1a664f1478d5..1b9bf000f598 100644 --- a/fs/incfs/pseudo_files.c +++ b/fs/incfs/pseudo_files.c @@ -147,8 +147,12 @@ static long ioctl_permit_fill(struct file *f, void __user *arg) return -EFAULT; file = fget(permit_fill.file_descriptor); - if (IS_ERR(file)) + if (IS_ERR_OR_NULL(file)) { + if (!file) + return -ENOENT; + return PTR_ERR(file); + } if (file->f_op != &incfs_file_ops) { error = -EPERM;