]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ALSA: seq_oss: return full count for successful SEQ_FULLSIZE writes
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Tue, 24 Mar 2026 19:59:41 +0000 (16:59 -0300)
committerTakashi Iwai <tiwai@suse.de>
Fri, 27 Mar 2026 13:40:24 +0000 (14:40 +0100)
snd_seq_oss_write() currently returns the raw load_patch() callback
result for SEQ_FULLSIZE events.

That callback is documented as returning 0 on success and -errno on
failure, but snd_seq_oss_write() is the file write path and should
report the number of user bytes consumed on success. Some in-tree
backends also return backend-specific positive values, which can still
be shorter than the original write size.

Return the full byte count for successful SEQ_FULLSIZE writes.
Preserve negative errors and convert any nonnegative completion to the
original count.

Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Link: https://patch.msgid.link/20260324-alsa-seq-oss-fullsize-write-return-v1-1-66d448510538@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/seq/oss/seq_oss_rw.c

index 8a142fd54a1907b3dd03164c6da584b5f9e1ef06..307ef98c44c7b58ee6434aa76c8eac3844d47aa9 100644 (file)
@@ -101,9 +101,9 @@ snd_seq_oss_write(struct seq_oss_devinfo *dp, const char __user *buf, int count,
                                break;
                        }
                        fmt = (*(unsigned short *)rec.c) & 0xffff;
-                       /* FIXME the return value isn't correct */
-                       return snd_seq_oss_synth_load_patch(dp, rec.s.dev,
-                                                           fmt, buf, 0, count);
+                       err = snd_seq_oss_synth_load_patch(dp, rec.s.dev,
+                                                          fmt, buf, 0, count);
+                       return err < 0 ? err : count;
                }
                if (ev_is_long(&rec)) {
                        /* extended code */