Page MenuHomeFreeBSD

Return EINVAL for userland CCBs with CAM_UNLOCKED set
ClosedPublic

Authored by markj on Mar 2 2017, 7:19 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 27, 8:51 AM
Unknown Object (File)
Feb 29 2024, 7:34 AM
Unknown Object (File)
Feb 23 2024, 12:53 PM
Unknown Object (File)
Jan 30 2024, 5:24 AM
Unknown Object (File)
Jan 9 2024, 11:49 AM
Unknown Object (File)
Dec 26 2023, 3:26 AM
Unknown Object (File)
Dec 22 2023, 10:20 PM
Unknown Object (File)
Dec 9 2023, 1:02 AM

Details

Summary

Userland cannot correctly set CAM_UNLOCKED; it is internal to the
implementation and not defined in the CAM spec. Thus, return EINVAL if
it's set in the CAMIOCOMMAND or CAMIOQUEUE argument.

I also noticed that some error paths in the CAMIOQUEUE handler don't
free the request or relock the periph, so fix that too.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7866
Build 8006: arc lint + arc unit

Event Timeline

markj retitled this revision from to Return EINVAL for userland CCBs with CAM_UNLOCKED set.
markj edited the test plan for this revision. (Show Details)
markj updated this object.
mav edited edge metadata.

It looks fine, except this flag is probably not the only one that should be banned.

This revision is now accepted and ready to land.Mar 2 2017, 7:27 PM
In D9869#203728, @mav wrote:

It looks fine, except this flag is probably not the only one that should be banned.

I looked for others, but didn't see any obvious candidates. Many CCB flags appear to have no handling at all in the kernel, and most of the rest appear to be used in some way by camcontrol.

ken edited edge metadata.

I agree with mav. This looks good, there might be other flags that we should ban as well if they come in from user land. But this is a good start.

This revision was automatically updated to reflect the committed changes.

-r314624 prevented a PowerMac G5 so-called "Quad Core" from competing
its boot (of -r314687): CAM status: Command timeout's. Reverting the two
files fixed it. See, e.g.,

https://lists.freebsd.org/pipermail/svn-src-head/2017-March/097981.html

-r314624 prevented a PowerMac G5 so-called "Quad Core" from competing
its boot (of -r314687): CAM status: Command timeout's. Reverting the two
files fixed it. See, e.g.,

https://lists.freebsd.org/pipermail/svn-src-head/2017-March/097981.html

This turned out to be apparently unrelated to the commit.