[Bug 208275] Kernel panic when reading from /dev/cd0 with a damaged dvd
    bugzilla-noreply at freebsd.org 
    bugzilla-noreply at freebsd.org
       
    Tue Mar 29 15:58:35 UTC 2016
    
    
  
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208275
--- Comment #9 from Fabian Keil <fk at fabiankeil.de> ---
I agree that moving the n calculation behind the error block
is technically sufficient to prevent the panic.
I added the NULL check in front of the brelse() because the function
contains a comment that indicates that passing NULL to it is considered
incorrect.
My assumption was that the brelse() was there for a reason and that bp
would sometimes not be NULL or at least could be in the future.
cluster_read() and bread*() indeed seem to reliably reset bp to NULL
on error, but unlike breadn_flags(), cluster_read() has no comment that
explicitly mentions this, so I wasn't sure that one can depend on this
behaviour.
If the behaviour is unlikely to change in the future, I agree that the
brelse() should be removed.
-- 
You are receiving this mail because:
You are on the CC list for the bug.
    
    
More information about the freebsd-current
mailing list