security: add missing create_tag checks in stream command handlers

do_cork_stream, do_flush_trigger_prebuf_stream, and do_set_stream_name
did not check whether the stream had completed format negotiation.
Add create_tag guards matching the pattern in do_set_stream_buffer_attr.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Wim Taymans 2026-04-29 18:26:01 +02:00
parent 6d2600c09d
commit d4a1278018

View file

@ -2707,6 +2707,8 @@ static int do_cork_stream(struct client *client, uint32_t command, uint32_t tag,
stream = pw_map_lookup(&client->streams, channel); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD) if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
return -ENOENT; return -ENOENT;
if (stream->create_tag != SPA_ID_INVALID)
return -ENOENT;
stream_set_corked(stream, cork); stream_set_corked(stream, cork);
if (cork) { if (cork) {
@ -2737,6 +2739,8 @@ static int do_flush_trigger_prebuf_stream(struct client *client, uint32_t comman
stream = pw_map_lookup(&client->streams, channel); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD) if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
return -ENOENT; return -ENOENT;
if (stream->create_tag != SPA_ID_INVALID)
return -ENOENT;
switch (command) { switch (command) {
case COMMAND_FLUSH_PLAYBACK_STREAM: case COMMAND_FLUSH_PLAYBACK_STREAM:
@ -3238,6 +3242,8 @@ static int do_set_stream_name(struct client *client, uint32_t command, uint32_t
stream = pw_map_lookup(&client->streams, channel); stream = pw_map_lookup(&client->streams, channel);
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD) if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
return -ENOENT; return -ENOENT;
if (stream->create_tag != SPA_ID_INVALID)
return -ENOENT;
items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_NAME, name); items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_NAME, name);
pw_stream_update_properties(stream->stream, pw_stream_update_properties(stream->stream,