soundwire: stream: validate slave port properties - #5849
Conversation
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>
|
Can one of the admins verify this patch?
|
|
test this please |
There was a problem hiding this comment.
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()duringsdw_slave_port_config(). - Rejects configurations where the port is unsupported or not available for the requested TX/RX direction, returning
-EINVALwith an error message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@kunjinkao-os Would you like us to submit this patch? |
Yes, please. I had planned to post a v2 after the SOF CI run, so I would appreciate it if you could submit the merged version upstream. Please CC me on the submission, and let me know if you need anything else from me. |
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:
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.