sound/pci/rme9652: prevent reading uninitialized stack memory
PATCH 1/1 sound/pci/rme9652: prevent reading uninitialized stack memory
The SNDRV_HDSP_IOCTL_GET_CONFIG_INFO and SNDRV_HDSP_IOCTL_GET_CONFIG_INFO ioctls in hdspm.c and hdsp.c allow unprivileged users to read uninitialized kernel stack memory, because several fields of the hdsp{m}_config_info structs declared on the stack are not altered or zeroed before being copied back to the user. This patch takes care of it.
sound/pci/rme9652/hdsp.c +2 -0
@@ -4601,6 +4601,8 @@ static int snd_hdsp_hwdep_ioctl(struct sunsigned long flags;int i; +memset (&info,0 ,sizeof (info)); + err =hdsp_check_for_iobox (hdsp);if (err <0 )return err;
sound/pci/rme9652/hdspm.c +3 -0
@@ -4128,6 +4128,9 @@ static int snd_hdspm_hwdep_ioctl(structcase SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO :spin_lock_irq (&hdspm->lock); + +memset (&info,0 ,sizeof (info)); + info.pref_sync_ref =hdspm_pref_sync_ref (hdspm); info.wordclock_sync_check =hdspm_wc_sync_check (hdspm);
Takashi Iwai
AppliedAt Sat, 25 Sep 2010 11:07:27 -0400,
Quoted 9 lines · Dan Rosenberg
The
SNDRV_HDSP_IOCTL_GET_CONFIG_INFOandSNDRV_HDSP_IOCTL_GET_CONFIG_INFOioctls inhdspm.candhdsp.callow unprivileged users to read uninitialized kernel stack memory, because several fields of the hdsp{m}_config_info structs declared on the stack are not altered or zeroed before being copied back to the user. This patch takes care of it.Signed-off-by Dan Rosenberg <[email protected]>
Thanks, applied now with minor optimization (memset outside spinlock).
Takashi
Quoted 27 lines
diff -urp
linux-2.6.35.5.orig/sound/pci/rme9652/hdsp.clinux-2.6.35.5/sound/pci/rme9652/hdsp.csound/pci/rme9652/hdsp.c +2
-0@@ -4601,6 +4601,8 @@ static int snd_hdsp_hwdep_ioctl(struct sunsigned long flags;int i; +memset (&info,0 ,sizeof (info)); + err =hdsp_check_for_iobox (hdsp);if (err <0 )return err;diff -urp
linux-2.6.35.5.orig/sound/pci/rme9652/hdspm.clinux-2.6.35.5/sound/pci/rme9652/hdspm.csound/pci/rme9652/hdspm.c +3
-0@@ -4128,6 +4128,9 @@ static int snd_hdspm_hwdep_ioctl(structcase SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO :spin_lock_irq (&hdspm->lock); + +memset (&info,0 ,sizeof (info)); + info.pref_sync_ref =hdspm_pref_sync_ref (hdspm); info.wordclock_sync_check =hdspm_wc_sync_check (hdspm);