]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.93/direct-io-prevent-null-pointer-access-in-submit_page_section.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.93 / direct-io-prevent-null-pointer-access-in-submit_page_section.patch
1 From 899f0429c7d3eed886406cd72182bee3b96aa1f9 Mon Sep 17 00:00:00 2001
2 From: Andreas Gruenbacher <agruenba@redhat.com>
3 Date: Mon, 9 Oct 2017 11:13:18 +0200
4 Subject: direct-io: Prevent NULL pointer access in submit_page_section
5
6 From: Andreas Gruenbacher <agruenba@redhat.com>
7
8 commit 899f0429c7d3eed886406cd72182bee3b96aa1f9 upstream.
9
10 In the code added to function submit_page_section by commit b1058b981,
11 sdio->bio can currently be NULL when calling dio_bio_submit. This then
12 leads to a NULL pointer access in dio_bio_submit, so check for a NULL
13 bio in submit_page_section before trying to submit it instead.
14
15 Fixes xfstest generic/250 on gfs2.
16
17 Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
18 Reviewed-by: Jan Kara <jack@suse.cz>
19 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22 ---
23 fs/direct-io.c | 3 ++-
24 1 file changed, 2 insertions(+), 1 deletion(-)
25
26 --- a/fs/direct-io.c
27 +++ b/fs/direct-io.c
28 @@ -823,7 +823,8 @@ out:
29 */
30 if (sdio->boundary) {
31 ret = dio_send_cur_page(dio, sdio, map_bh);
32 - dio_bio_submit(dio, sdio);
33 + if (sdio->bio)
34 + dio_bio_submit(dio, sdio);
35 page_cache_release(sdio->cur_page);
36 sdio->cur_page = NULL;
37 }