Do not access buffer if bread(9) or cluster_read(9) failed. On error,

the functions free the buffer and set the pointer to NULL.  Also
remove useless call to brelse(9) on the error path.

PR:	208275
Submitted by:	Fabian Keil <fk@fabiankeil.de>
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2016-03-29 19:59:44 +00:00
parent 9c64cfe56c
commit cc4916adf2

View File

@ -341,11 +341,9 @@ cd9660_read(ap)
} else
error = bread(vp, lbn, size, NOCRED, &bp);
}
n = MIN(n, size - bp->b_resid);
if (error) {
brelse(bp);
if (error != 0)
return (error);
}
n = MIN(n, size - bp->b_resid);
error = uiomove(bp->b_data + on, (int)n, uio);
brelse(bp);