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 <tadeusz.struk@linaro.org>
Change-Id: Iec8be21982afeab6794b78ab1a542671c52acea2
diff --git a/fs/incfs/pseudo_files.c b/fs/incfs/pseudo_files.c
index 1a664f1..1b9bf00 100644
--- a/fs/incfs/pseudo_files.c
+++ b/fs/incfs/pseudo_files.c
@@ -147,8 +147,12 @@
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;