Skip to contentSkip to conversation

Patch "ALSA: hdspm: Fix zero-division" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Mar 5, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ALSA: hdspm: Fix zero-division

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
alsa-hdspm-fix-zero-division.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From c1099c3294c2344110085a38c50e478a5992b368 Mon Sep 17 00:00:00 2001

From: Takashi Iwai <[email protected]>
Date: Mon, 29 Feb 2016 14:32:42 +0100
Subject: ALSA: hdspm: Fix zero-division

From: Takashi Iwai <[email protected]>

commit c1099c3294c2344110085a38c50e478a5992b368 upstream.

HDSPM driver contains a code issuing zero-division potentially in system sample rate ctl code. This patch fixes it by not processing a zero or invalid rate value as a divisor, as well as excluding the invalid value to be passed via the given ctl element.

---
 sound/pci/rme9652/hdspm.c |    8 ++++++++
 1 file changed, 8 insertions(+)
sound/pci/rme9652/hdspm.c +8 -0
@@ -1601,6 +1601,9 @@ static void hdspm_set_dds_value(struct h
 {
 	u64 n;
 
+	if (snd_BUG_ON(rate <= 0))
+		return;
+
 	if (rate >= 112000)
 		rate /= 4;
 	else if (rate >= 56000)
@@ -2215,6 +2218,8 @@ static int hdspm_get_system_sample_rate(
 		} else {
 			/* slave mode, return external sample rate */
 			rate = hdspm_external_sample_rate(hdspm);
+			if (!rate)
+				rate = hdspm->system_sample_rate;
 		}
 	}
 
@@ -2260,7 +2265,10 @@ static int snd_hdspm_put_system_sample_r
 					    ucontrol)
 {
 	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
+	int rate = ucontrol->value.integer.value[0];
 
+	if (rate < 27000 || rate > 207000)
+		return -EINVAL;
 	hdspm_set_dds_value(hdspm, ucontrol->value.integer.value[0]);
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/alsa-hdspm-fix-zero-division.patch queue-4.4/alsa-ctl-fix-ioctls-for-x32-abi.patch queue-4.4/alsa-hdspm-fix-wrong-boolean-ctl-value-accesses.patch queue-4.4/alsa-pcm-fix-ioctls-for-x32-abi.patch queue-4.4/alsa-hdsp-fix-wrong-boolean-ctl-value-accesses.patch queue-4.4/alsa-seq-oss-don-t-drain-at-closing-a-client.patch queue-4.4/alsa-hda-fix-mic-issues-on-acer-aspire-e1-472.patch queue-4.4/alsa-timer-fix-ioctls-for-x32-abi.patch queue-4.4/alsa-usb-audio-add-a-quirk-for-plantronics-da45.patch queue-4.4/alsa-timer-fix-broken-compat-timer-user-status-ioctl.patch queue-4.4/alsa-rawmidi-fix-ioctls-x32-abi.patch