All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: HyeongJun An <sammiee5311@gmail.com>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: seq: Restore the delivery error code in the bounce event
Date: Wed, 12 Aug 2026 15:01:19 +0200	[thread overview]
Message-ID: <87se4jze5c.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260812113236.3941391-1-sammiee5311@gmail.com>

On Wed, 12 Aug 2026 13:32:36 +0200,
HyeongJun An wrote:
> 
> Commit efc86691e4d8 ("ALSA: seq: Fix kernel heap address leak in
> bounce_error_event()") moved the data.quote.value assignment into the
> kernel client branch.  A user client that sets SNDRV_SEQ_FILTER_BOUNCE
> used to get the delivery error code there.  Now it gets none, and
> nothing else reports it, because a queued event's write() has already
> returned success by the time delivery fails.
> 
> Send struct snd_seq_event_bounce instead, the error code followed by the
> original event record, which is what the UAPI header has described all
> along.  Store the negative errno.  The kernel client branch negates it
> only because data.quote.value is an unsigned short.
> 
> The payload grows from 28 to 32 bytes.  The snd_seq_read() rounds a
> variable-length payload up to a multiple of the event size, so a legacy
> client now needs an 84 byte buffer instead of 56.  That is what any
> event carrying 29 payload bytes has always needed.  A UMP client reads
> 64 bytes either way.
> 
> Drop the stale promise to copy the external data after the event record
> as well.  That was never implemented, and bounce_error_event() runs with
> atomic set from the timer interrupt.
> 
> Fixes: efc86691e4d8 ("ALSA: seq: Fix kernel heap address leak in bounce_error_event()")
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
> ---
> Notes for the reviewer, not part of the change.
> 
> A UMP event does not fit the payload.  A struct snd_seq_ump_event is 32
> bytes while quoted.event is 28, so ump[3] is dropped while
> SNDRV_SEQ_EVENT_UMP stays set in the copy.  That is already true today,
> but this locks it into the UAPI.  Clear the flag, skip bouncing UMP
> events, or a different layout?  I did not want to guess.
> 
> The err field carries the negative errno.  Nothing has ever produced or
> consumed this struct, so the sign is being chosen here for the first
> time.  Say if you want the positive value instead.
> 
> I could not check whether any user space sets SNDRV_SEQ_FILTER_BOUNCE,
> or what buffer size it reads with.

Thanks, now I see what you meant previously.

I belive that struct snd_seq_event_bounce is dead, not actually used.
So, it's better to stick with the existing snd_seq_ev_quote even
though we lose the error code in user-space delivery.  The definition
of snd_seq_event_bounce can be dropped for avoiding confusion in
future, too.


Takashi

  reply	other threads:[~2026-08-12 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 11:32 [PATCH] ALSA: seq: Restore the delivery error code in the bounce event HyeongJun An
2026-08-12 13:01 ` Takashi Iwai [this message]
2026-08-12 14:15   ` [PATCH] ALSA: seq: Drop the dead struct snd_seq_event_bounce HyeongJun An
2026-08-12 14:39     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87se4jze5c.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=sammiee5311@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.