Home Home > GIT Browse > openSUSE-42.3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Abraham <tabraham@suse.com>2019-01-16 11:25:26 -0500
committerThomas Abraham <tabraham@suse.com>2019-01-16 11:34:36 -0500
commite3f1063f67c361a3e2ad489f563e1055db69c0d1 (patch)
treeffb73752248997924f62661505797cef5f3079ce
parent31f578cb49cddeca2d556a0d85e375a6e2fe1af8 (diff)
aio: hold an extra file reference over AIO read/write operations
(bsc#1116027).
-rw-r--r--patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch44
-rw-r--r--series.conf1
2 files changed, 45 insertions, 0 deletions
diff --git a/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch b/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch
new file mode 100644
index 0000000000..f3fb709487
--- /dev/null
+++ b/patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch
@@ -0,0 +1,44 @@
+From 0b944d3a4bba6b25f43aed530f4fa85c04d162a6 Mon Sep 17 00:00:00 2001
+From: Christoph Hellwig <hch@lst.de>
+Date: Sun, 30 Oct 2016 11:42:01 -0500
+Subject: [PATCH] aio: hold an extra file reference over AIO read/write
+ operations
+References: bsc#1116027
+Git-commit: 0b944d3a4bba6b25f43aed530f4fa85c04d162a6
+Patch-mainline: v4.9-rc5
+
+Otherwise we might dereference an already freed file and/or inode
+when aio_complete is called before we return from the read_iter or
+write_iter method.
+
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Thomas Abraham <tabraham@suse.com>
+[tabraham@suse.com: handled backport - minor modification for context]
+---
+ fs/aio.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/fs/aio.c b/fs/aio.c
+index 1157e13a36d6..0aa71d338c04 100644
+--- a/fs/aio.c
++++ b/fs/aio.c
+@@ -1460,6 +1460,7 @@ static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode,
+
+ len = ret;
+
++ get_file(file);
+ if (rw == WRITE)
+ file_start_write(file);
+
+@@ -1467,6 +1468,7 @@ static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode,
+
+ if (rw == WRITE)
+ file_end_write(file);
++ fput(file);
+ kfree(iovec);
+ break;
+
+--
+2.13.7
+
diff --git a/series.conf b/series.conf
index 83dc86ab61..eab7b4aee4 100644
--- a/series.conf
+++ b/series.conf
@@ -25045,6 +25045,7 @@
patches.suse/hpwdt-calculate-reload-each-use.patch
patches.suse/hpwdt-add-dynamic-debug.patch
+ patches.fixes/aio-hold-an-extra-file-reference-over-AIO-read-write.patch
########################################################
# You'd better have a good reason for adding a patch
# below here.