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 <[email protected]> Tested-by: Commit checker robot <[email protected]> Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user