Skip to content

Commit 10626a0

Browse files
tiwaigregkh
authored andcommitted
ALSA: vmaster: Propagate slave error
[ Upstream commit 2e2c177 ] In slave_update() of vmaster code ignores the error from the slave get() callback and copies the values. It's not only about the missing error code but also that this may potentially lead to a leak of uninitialized variables when the slave get() don't clear them. This patch fixes slave_update() not to copy the potentially uninitialized values when an error is returned from the slave get() callback, and to propagate the error value properly. Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b1ebc21 commit 10626a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/core/vmaster.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,13 @@ static int slave_update(struct link_slave *slave)
6868
return -ENOMEM;
6969
uctl->id = slave->slave.id;
7070
err = slave->slave.get(&slave->slave, uctl);
71+
if (err < 0)
72+
goto error;
7173
for (ch = 0; ch < slave->info.count; ch++)
7274
slave->vals[ch] = uctl->value.integer.value[ch];
75+
error:
7376
kfree(uctl);
74-
return 0;
77+
return err < 0 ? err : 0;
7578
}
7679

7780
/* get the slave ctl info and save the initial values */

0 commit comments

Comments
 (0)