Page MenuHomeFreeBSD

sound: Check for errors from sndbuf_resize()
Needs ReviewPublic

Authored by markj on Fri, Oct 9, 9:14 PM.
Tags
None
Referenced Files
F175785243: D60553.id189304.diff
Tue, Oct 13, 8:36 AM
F175716504: D60553.id.diff
Mon, Oct 12, 6:06 PM
Unknown Object (File)
Mon, Oct 12, 12:21 PM
Unknown Object (File)
Mon, Oct 12, 8:04 AM
Unknown Object (File)
Mon, Oct 12, 5:18 AM
Unknown Object (File)
Sun, Oct 11, 7:06 PM
Unknown Object (File)
Sun, Oct 11, 2:46 PM
Unknown Object (File)
Sun, Oct 11, 1:29 PM
Subscribers

Details

Summary

Most implementations of CHANNEL_SETBLOCKSIZE and CHANNEL_SETFRAGMENTS
were not checking this. This is probably not a big problem: it's
unlikely for sndbuf_resize() to fail due to the refcount check in this
case since it's operating on the hardware buffer, which doesn't get
mmaped. But, I will add more reasons for it to fail in the next patch,
so let's be more careful.

This change modifies various CHANNEL_SETBLOCKSIZE implementations to
check for errors. In some cases I reordered things to avoid updating
driver state until after sndbuf_resize() succeeds.

Return 0 from CHANNEL_SETBLOCKSIZE to indicate an error, as it otherwise
returns the new block size. We could change the interface to return
both an error number and a block size, but that would break at least one
out-of-tree driver and I wish to avoid that here. Make sure that errors
from CHANNEL_SETFRAGMENTS are returned to userspace.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77928
Build 74811: arc lint + arc unit