Page MenuHomeFreeBSD

cam: Let cam_periph_unmapmem() return an error
ClosedPublic

Authored by markj on Dec 26 2023, 11:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 5:47 PM
Unknown Object (File)
Sun, May 5, 1:15 AM
Unknown Object (File)
Wed, May 1, 1:52 AM
Unknown Object (File)
Wed, May 1, 1:51 AM
Unknown Object (File)
Wed, May 1, 1:51 AM
Unknown Object (File)
Sun, Apr 28, 1:02 AM
Unknown Object (File)
Fri, Apr 26, 1:43 PM
Unknown Object (File)
Thu, Apr 25, 1:21 AM
Subscribers

Details

Summary

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

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().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Dec 28 2023, 3:52 PM
mav added inline comments.
sys/cam/scsi/scsi_target.c
911–914

These printf's are weird to see, but I don't know anybody still using this code, so whatever.

sys/cam/scsi/scsi_target.c
911–914

Indeed, I just copied it for consistency with the printf below.

This revision was automatically updated to reflect the committed changes.