mirror of
https://review.haiku-os.org/haiku
synced 2025-01-18 20:48:48 +01:00
FAT: Fix potential dereference of NULL pointer
* Can occur if bread() returns an error code in readep(). * Fixes #19105. Change-Id: I975c7d729c59b175c4a6249bbb4660e1294a0ef1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8363 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
This commit is contained in:
parent
6b4ccaa5be
commit
ed37f3a29d
@ -204,13 +204,16 @@ bawrite(struct buf* bp)
|
||||
void
|
||||
brelse(struct buf* bp)
|
||||
{
|
||||
if (bp->b_vreg != NULL) {
|
||||
put_buf(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
struct mount* bsdVolume = bp->b_vp->v_rdev->si_mountpt;
|
||||
void* blockCache = bsdVolume->mnt_cache;
|
||||
bool readOnly = MOUNTED_READ_ONLY(VFSTOMSDOSFS(bsdVolume));
|
||||
|
||||
if (bp->b_vreg != NULL) {
|
||||
put_buf(bp);
|
||||
} else if (bp->b_owned == false) {
|
||||
if (bp->b_owned == false) {
|
||||
if (readOnly == true)
|
||||
block_cache_set_dirty(blockCache, bp->b_blkno, false, -1);
|
||||
block_cache_put(blockCache, bp->b_blkno);
|
||||
|
Loading…
Reference in New Issue
Block a user