]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: control: fix a redundant-copy issue
authorWenwen Wang <wang6495@umn.edu>
Sat, 5 May 2018 18:38:03 +0000 (13:38 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 21 Oct 2018 07:46:03 +0000 (08:46 +0100)
commit250335bbf19b4a9a9525d20d567f21f1970cada6
tree906de56d31b7f4e0c001b3477034f0a1c7d513e1
parent3134c5a32810c510f1f447c135cec346acbb71c3
ALSA: control: fix a redundant-copy issue

commit 3f12888dfae2a48741c4caa9214885b3aaf350f9 upstream.

In snd_ctl_elem_add_compat(), the fields of the struct 'data' need to be
copied from the corresponding fields of the struct 'data32' in userspace.
This is achieved by invoking copy_from_user() and get_user() functions. The
problem here is that the 'type' field is copied twice. One is by
copy_from_user() and one is by get_user(). Given that the 'type' field is
not used between the two copies, the second copy is *completely* redundant
and should be removed for better performance and cleanup. Also, these two
copies can cause inconsistent data: as the struct 'data32' resides in
userspace and a malicious userspace process can race to change the 'type'
field between the two copies to cause inconsistent data. Depending on how
the data is used in the future, such an inconsistency may cause potential
security risks.

For above reasons, we should take out the second copy.

Signed-off-by: Wenwen Wang <wang6495@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/control_compat.c