Skip to content

soundwire: stream: validate slave port properties - #5849

Open
kunjinkao-os wants to merge 1 commit into
thesofproject:topic/sof-devfrom
kunjinkao-os:sof-ci-soundwire-port-check
Open

soundwire: stream: validate slave port properties#5849
kunjinkao-os wants to merge 1 commit into
thesofproject:topic/sof-devfrom
kunjinkao-os:sof-ci-soundwire-port-check

Conversation

@kunjinkao-os

Copy link
Copy Markdown

sdw_slave_port_config() currently checks whether a port number is in
the generic valid range, but it does not check whether the Slave
actually exposes that port for the requested stream direction.

This means that an in-range but unsupported port, or a valid port used
in the wrong direction, can be accepted.

Use sdw_get_slave_dpn_prop() to perform the direction-specific lookup
before accepting the port configuration.

Local build testing was done with GCC 9.4 using allmodconfig, W=1 and
-Werror for the following architectures:

  • x86_64
  • i386
  • arm64
  • arm
  • riscv64

All builds completed without warnings or errors.

I do not have SoundWire hardware available locally, so I would
appreciate testing on the available SOF SoundWire platforms.

sdw_slave_port_config() validates that a port number is within the
generic valid range, but does not verify that the Slave exposes the
port for the requested stream direction. As a result, an in-range but
unsupported port can be accepted.

Use sdw_get_slave_dpn_prop() to perform the direction-specific lookup
and reject unsupported ports before storing the runtime configuration.

Signed-off-by: Eric Wu <kunjinkao.jp@gmail.com>
@kunjinkao-os
kunjinkao-os requested a review from shumingfan as a code owner July 21, 2026 09:27
@sofci

sofci commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Can one of the admins verify this patch?

reply test this please to run this test once

@kunjinkao-os

Copy link
Copy Markdown
Author

test this please

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens SoundWire slave port configuration validation by ensuring a requested port is not only within the generic numeric range, but also actually present in the slave’s direction-specific DPN capabilities.

Changes:

  • Adds a direction-aware capability lookup via sdw_get_slave_dpn_prop() during sdw_slave_port_config().
  • Rejects configurations where the port is unsupported or not available for the requested TX/RX direction, returning -EINVAL with an error message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants