Module Name:    src
Committed By:   jdolecek
Date:           Sun May 24 14:11:49 UTC 2020

Modified Files:
        src/sys/uvm: uvm_swap.c

Log Message:
fix KASAN PoolUseAfterFree for async write - can't read bp after VOP_STRATEGY()

problem found and fix provided by Paul Ripke


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/uvm/uvm_swap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.192 src/sys/uvm/uvm_swap.c:1.193
--- src/sys/uvm/uvm_swap.c:1.192	Fri May 22 11:54:05 2020
+++ src/sys/uvm/uvm_swap.c	Sun May 24 14:11:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.192 2020/05/22 11:54:05 jdolecek Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.193 2020/05/24 14:11:49 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.192 2020/05/22 11:54:05 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.193 2020/05/24 14:11:49 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -1985,7 +1985,7 @@ uvm_swap_io(struct vm_page **pps, int st
 		 * Reads are always synchronous; if this changes, we
 		 * need to add an asynchronous path for decryption.
 		 */
-		KASSERT((bp->b_flags & B_READ) == 0);
+		KASSERT(write);
 		return 0;
 	}
 

Reply via email to