HomeFreeBSD

cam: Let cam_periph_unmapmem() return an error

Description

cam: Let cam_periph_unmapmem() return an error

As of commit b059686a71c8, cam_periph_unmapmem() can legitimately fail
if the copyout() operation fails. However, this failure was never
signaled to upper layers. In practice it is unlikely to occur
since cap_periph_mapmem() would most likely fail in such
circumstances anyway, but an error is nonetheless possible.

However, some code reading revealed a few paths where the return value
of cam_periph_mapmem() is not checked, and this is definitely a bug.
Add error checking there and let cam_periph_unmapmem() return errors
from copyout().

Reviewed by: dab, mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43201

(cherry picked from commit d068ea16e3264c2d62472a8acf794262cfe703dd)

Details

Provenance
markjAuthored on Dec 28 2023, 5:08 PM
Reviewer
dab
Differential Revision
D43201: cam: Let cam_periph_unmapmem() return an error
Parents
rGe4db787bb86b: frag6: Add another use of frag6_rmqueue()
Branches
Unknown
Tags
Unknown