git: 9cfd75a6f88f - stable/15 - bio: Fix KASAN invalid access report in biodone

From: Ka Ho Ng <khng_at_FreeBSD.org>
Date: Mon, 29 Dec 2025 18:49:27 UTC
The branch stable/15 has been updated by khng:

URL: https://cgit.FreeBSD.org/src/commit/?id=9cfd75a6f88f2076d7cd7e18acc9d89f6055e8fe

commit 9cfd75a6f88f2076d7cd7e18acc9d89f6055e8fe
Author:     Ka Ho Ng <khng@FreeBSD.org>
AuthorDate: 2025-12-29 15:49:29 +0000
Commit:     Ka Ho Ng <khng@FreeBSD.org>
CommitDate: 2025-12-29 18:47:56 +0000

    bio: Fix KASAN invalid access report in biodone
    
    Do not touch the bio fields after calling the bio_done callback. The bio
    might have been freed after the callback returns.
    
    Fixes:  725f4b108d54
    Reported by:    kp, markj
---
 sys/kern/vfs_bio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index dc90bd3add22..2368f863a248 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -4523,8 +4523,6 @@ biodone(struct bio *bp)
 			bp->bio_flags |= BIO_ERROR_COMPAT;
 		}
 		done(bp);
-		bp->bio_error_compat = 0;
-		bp->bio_flags &= ~BIO_ERROR_COMPAT;
 	}
 }