lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 17 Oct 2022 18:04:37 +0800
From:   Hoi Pok Wu <wuhoipok@...il.com>
To:     jaegeuk@...nel.org, chao@...nel.org
Cc:     Hoi Pok Wu <wuhoipok@...il.com>,
        linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org,
        syzbot+035a381ea1afb63f098d@...kaller.appspotmail.com,
        syzkaller-bugs@...glegroups.com
Subject: [PATCH] fs: f2fs: fix kernel discard_thread NULL dereference

Pointer discard_thread is pointing to nowhere, using IS_ERR prevents the
situation. IS_ERR also seen being used throughout the file.

Link: https://syzkaller.appspot.com/bug?id=9499bc6574cea5940e48199c2fd0732d9b11e5e1
Reported-by: syzbot+035a381ea1afb63f098d@...kaller.appspotmail.com
Signed-off-by: Hoi Pok Wu <wuhoipok@...il.com>
---
 fs/f2fs/segment.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index acf3d3fa4363..79978b7206b5 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1634,7 +1634,8 @@ void f2fs_stop_discard_thread(struct f2fs_sb_info *sbi)
 		struct task_struct *discard_thread = dcc->f2fs_issue_discard;
 
 		dcc->f2fs_issue_discard = NULL;
-		kthread_stop(discard_thread);
+		if (!IS_ERR(discard_thread))
+			kthread_stop(discard_thread);
 	}
 }
 
-- 
2.38.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ