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, Jan 19, 10:27 PM
Unknown Object (File)
Sat, Jan 10, 3:26 PM
Unknown Object (File)
Sat, Jan 10, 8:09 AM
Unknown Object (File)
Sat, Jan 10, 5:13 AM
Unknown Object (File)
Sat, Jan 10, 4:49 AM
Unknown Object (File)
Dec 11 2025, 8:15 AM
Unknown Object (File)
Nov 25 2025, 6:20 PM
Unknown Object (File)
Oct 14 2025, 1:33 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 55129
Build 52018: arc lint + arc unit

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
914–917

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
914–917

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

This revision was automatically updated to reflect the committed changes.