Skip to contentSkip to conversation

ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()

PATCH In review Dan Carpenter 4 participants 5 messages May 3, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()

We intended || here instead of &&. The original code potentially leads to a NULL dereference.

Fixes 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
sound/soc/codecs/hdac_hdmi.c +1 -1
index 3043120..7e7ff1b 100644
@@ -1609,7 +1609,7 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 	struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
 	struct hdac_hdmi_pin *pin = pcm->pin;
 
-	if (!pin && !pin->eld.eld_valid)
+	if (!pin || !pin->eld.eld_valid)
 		return 0;
 
 	return pin->eld.info.spk_alloc;
#1 lore raw
Quoted 5 lines · Dan Carpenter

We intended || here instead of &&. The original code potentially leads to a NULL dereference.

Fixes 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')

Indeed.

sound/soc/codecs/hdac_hdmi.c static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) · line 1615

Quoted 13 lines
sound/soc/codecs/hdac_hdmi.c +1 -1
index 3043120..7e7ff1b 100644
@@ -1609,7 +1609,7 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 	struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
 	struct hdac_hdmi_pin *pin = pcm->pin;
 
-	if (!pin && !pin->eld.eld_valid)
+	if (!pin || !pin->eld.eld_valid)
 		return 0;
 
 	return pin->eld.info.spk_alloc;

Regards

Takashi Sakamoto

#2 lore raw
In reply to Dan Carpenter
Quoted 2 lines · Dan Carpenter

We intended || here instead of &&. The original code potentially leads to a NULL dereference.

This looks good to me, I will test this and get back

Quoted 17 lines
Fixes 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
sound/soc/codecs/hdac_hdmi.c +1 -1
index 3043120..7e7ff1b 100644
@@ -1609,7 +1609,7 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 	struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
 	struct hdac_hdmi_pin *pin = pcm->pin;
 
-	if (!pin && !pin->eld.eld_valid)
+	if (!pin || !pin->eld.eld_valid)
 		return 0;
 
 	return pin->eld.info.spk_alloc;
Signature · 1 line
~Vinod
maintainer
#4 lore raw

Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree

In reply to Dan Carpenter

The patch

ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 8f658815da156a9239b98b34e5ba1d3db71a2f6e Mon Sep 17 00:00:00 2001

From: Dan Carpenter <[email protected]>
Date: Tue, 3 May 2016 10:42:58 +0300
Subject: [PATCH] ASoC: hdac_hdmi: Potential NULL deref in
hdac_hdmi_get_spk_alloc()

We intended || here instead of &&. The original code potentially leads to a NULL dereference.

Fixes 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
---
 sound/soc/codecs/hdac_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/hdac_hdmi.c +1 -1
index 0ed39753c871..f1170e060230 100644
@@ -1614,7 +1614,7 @@ static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx)
 	struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
 	struct hdac_hdmi_pin *pin = pcm->pin;
 
-	if (!pin && !pin->eld.eld_valid)
+	if (!pin || !pin->eld.eld_valid)
 		return 0;
 
 	return pin->eld.info.spk_alloc;
Signature · 1 line
2.8.1