ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace
Subsystems (4)
PATCH 1/1 ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace
From: Colin Ian King <[email protected]>
Field header.tlv is uninitialized and being copied back to userspace and hence leaking data from the stack to userspace. Fix this by ensuring the header structure is zero'd.
Addresses-Coverity: ("Uninitialized scalar variable")
--- sound/soc/sof/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sof/control.c +1 -1
@@ -362,7 +362,7 @@ int snd_sof_bytes_ext_get(struct snd_kcontrol *kcontrol,struct snd_sof_control *scontrol = be->dobj.private;struct snd_soc_component *scomp = scontrol->scomp;struct sof_ipc_ctrl_data *cdata = scontrol->control_data; -struct snd_ctl_tlv header; +struct snd_ctl_tlv header = { };struct snd_ctl_tlv __user *tlvd (struct snd_ctl_tlv __user *)binary_data;int data_size;
Signature · 1 line
2.25.1
Quoted 3 lines · Colin King
From: Colin Ian King <[email protected]>
Field header.tlv is uninitialized and being copied back to userspace
^^^^^^^^^^
header.tlv is a zero element array so it doens't have any stack data.
Quoted 2 lines
and hence leaking data from the stack to userspace. Fix this by ensuring the header structure is zero'd.
regards,
dan carpenter
Quoted 6 lines · Dan Carpenter
Quoted 3 lines · Colin King
From: Colin Ian King <[email protected]>
Field header.tlv is uninitialized and being copied back to userspace
^^^^^^^^^^header.tlv is a zero element array so it doens't have any stack data.
Thanks Dan, I totally overlooked that. That's another class if issues I need to triage correctly.
Quoted 8 lines
Quoted 3 lines
and hence leaking data from the stack to userspace. Fix this by ensuring the header structure is zero'd.
regards,
dan carpenter