* [PATCH] ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace
@ 2020-04-22 11:24 Colin King
2020-04-22 11:45 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2020-04-22 11:24 UTC (permalink / raw)
To: Pierre-Louis Bossart, Liam Girdwood, Ranjani Sridharan,
Kai Vehmanen, Daniel Baluta, Mark Brown, Jaroslav Kysela,
Takashi Iwai, sound-open-firmware, alsa-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
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.
Fixes: c3078f539704 ("ASoC: SOF: Add Sound Open Firmware KControl support")
Addresses-Coverity: ("Uninitialized scalar variable")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
sound/soc/sof/control.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c
index dfc412e2d956..97d5c1a4c1ff 100644
--- a/sound/soc/sof/control.c
+++ b/sound/soc/sof/control.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace
2020-04-22 11:24 [PATCH] ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace Colin King
@ 2020-04-22 11:45 ` Dan Carpenter
2020-04-22 11:57 ` Colin Ian King
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-04-22 11:45 UTC (permalink / raw)
To: Colin King
Cc: Pierre-Louis Bossart, Liam Girdwood, Ranjani Sridharan,
Kai Vehmanen, Daniel Baluta, Mark Brown, Jaroslav Kysela,
Takashi Iwai, sound-open-firmware, alsa-devel, kernel-janitors,
linux-kernel
On Wed, Apr 22, 2020 at 12:24:17PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> 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.
> and hence leaking data from the stack to userspace. Fix this by
> ensuring the header structure is zero'd.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace
2020-04-22 11:45 ` Dan Carpenter
@ 2020-04-22 11:57 ` Colin Ian King
0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2020-04-22 11:57 UTC (permalink / raw)
To: Dan Carpenter
Cc: Pierre-Louis Bossart, Liam Girdwood, Ranjani Sridharan,
Kai Vehmanen, Daniel Baluta, Mark Brown, Jaroslav Kysela,
Takashi Iwai, sound-open-firmware, alsa-devel, kernel-janitors,
linux-kernel
On 22/04/2020 12:45, Dan Carpenter wrote:
> On Wed, Apr 22, 2020 at 12:24:17PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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.
>
>> and hence leaking data from the stack to userspace. Fix this by
>> ensuring the header structure is zero'd.
>
> regards,
> dan carpenter
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-22 11:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-22 11:24 [PATCH] ASoC: SOF: ensure all fields in header are zero'd before copying back to userspace Colin King
2020-04-22 11:45 ` Dan Carpenter
2020-04-22 11:57 ` Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox