Skip to content

RFC ALSA: Don't embed struct devices

Takashi Iwai alsa-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest9 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9ALSA: core: Introduce snd_device_alloc()include/sound/core.h sound/core/init.c+32 -00 replies
2/9ALSA: control: Don't embed ctl_devinclude/sound/core.h sound/core/control.c sound/core/control_led.c +1 more+12 -100 replies
3/9ALSA: pcm: Don't embed deviceinclude/sound/pcm.h sound/aoa/soundbus/i2sbus/pcm.c sound/core/pcm.c +1 more+17 -130 replies
4/9ALSA: hwdep: Don't embed deviceinclude/sound/hwdep.h sound/core/hwdep.c sound/pci/hda/hda_hwdep.c+24 -200 replies
5/9ALSA: rawmidi: Don't embed deviceinclude/sound/rawmidi.h sound/core/rawmidi.c sound/core/ump.c+18 -210 replies
6/9ALSA: compress: Don't embed deviceinclude/sound/compress_driver.h sound/core/compress_offload.c+11 -70 replies
7/9ALSA: timer: Create device with snd_device_alloc()sound/core/timer.c+9 -70 replies
8/9ALSA: seq: Create device with snd_device_alloc()sound/core/seq/seq_clientmgr.c+9 -70 replies
9/9ALSA: core: Drop snd_device_initialize()include/sound/core.h sound/core/init.c+0 -240 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJaroslav KyselaCurtis Malainey
SeriesR-b T-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH RFC 0/9] ALSA: Don't embed struct devices

Hi,

this is another set of patches to attempt papering over the UAF problems that are seen when the delayed kobject release is enabled, as initially reported by Curtis:
https://lore.kernel.org/r/[email protected]

There was a previous patch set with a different approach (using the device refcount dependencies), but this is a sort of step-back to the old way.
https://lore.kernel.org/r/[email protected]

After discussions and evaluations, we agreed that decoupling the struct device from each sound component object is the safest (and easiest) way as of now. For applying the changes more consistently, I introduced a new helper for the struct device allocation and initialization, and applied all components.

A couple of more changes for card_dev refcount managed aren't included in this patch set, though. They might be good to have, but this patch set should suffice for the currently seen UAF problems.

For a long-term solution, we may restructure the device management, then the struct devices may be embedded again in each object. But, it'll need lots of other changes and cleanups, a big TODO.

The latest patches are found in topic/dev-split branch of sound.git tree.

Takashi

===

Takashi Iwai (9):
ALSA: core: Introduce snd_device_alloc()
ALSA: control: Don't embed ctl_dev
ALSA: pcm: Don't embed device
ALSA: hwdep: Don't embed device
ALSA: rawmidi: Don't embed device
ALSA: compress: Don't embed device
ALSA: timer: Create device with snd_device_alloc()
ALSA: seq: Create device with snd_device_alloc()
ALSA: core: Drop snd_device_initialize()

 include/sound/compress_driver.h |  2 +-
 include/sound/core.h            |  4 ++--
 include/sound/hwdep.h           |  2 +-
 include/sound/pcm.h             |  2 +-
 include/sound/rawmidi.h         |  2 +-
 sound/aoa/soundbus/i2sbus/pcm.c |  4 ++--
 sound/core/compress_offload.c   | 16 ++++++++------
 sound/core/control.c            | 14 ++++++------
 sound/core/control_led.c        |  4 ++--
 sound/core/hwdep.c              | 38 ++++++++++++++++++---------------
 sound/core/init.c               | 28 +++++++++++++++---------
 sound/core/pcm.c                | 22 +++++++++++--------
 sound/core/rawmidi.c            | 29 +++++++++++--------------
 sound/core/seq/seq_clientmgr.c  | 16 ++++++++------
 sound/core/timer.c              | 16 ++++++++------
 sound/core/ump.c                |  8 +++----
 sound/pci/hda/hda_hwdep.c       |  4 ++--
 sound/usb/media.c               |  4 ++--
 18 files changed, 119 insertions(+), 96 deletions(-)
Signature · 1 line
2.35.3