linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
@ 2016-05-03  7:42 Dan Carpenter
  2016-05-03  7:58 ` Takashi Sakamoto
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2016-05-03  7:42 UTC (permalink / raw)
  To: Liam Girdwood, Subhransu S. Prusty
  Cc: Mark Brown, Jaroslav Kysela, Takashi Iwai, Vinod Koul, Jeeja KP,
	Sudip Mukherjee, Arnd Bergmann, alsa-devel, linux-kernel,
	kernel-janitors

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

Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 3043120..7e7ff1b 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -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;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
  2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
@ 2016-05-03  7:58 ` Takashi Sakamoto
  2016-05-03  9:56 ` Vinod Koul
  2016-05-03 16:31 ` Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Takashi Sakamoto @ 2016-05-03  7:58 UTC (permalink / raw)
  To: Dan Carpenter, Liam Girdwood, Subhransu S. Prusty
  Cc: alsa-devel, Arnd Bergmann, Vinod Koul, linux-kernel,
	kernel-janitors, Takashi Iwai, Mark Brown, Jeeja KP,
	Sudip Mukherjee

On May 03 2016 16:42, Dan Carpenter wrote:
> We intended || here instead of &&.  The original code potentially leads
> to a NULL dereference.
> 
> Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Indeed.

Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

> diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
> index 3043120..7e7ff1b 100644
> --- a/sound/soc/codecs/hdac_hdmi.c
> +++ b/sound/soc/codecs/hdac_hdmi.c
> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
  2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
  2016-05-03  7:58 ` Takashi Sakamoto
@ 2016-05-03  9:56 ` Vinod Koul
  2016-05-03 16:06   ` Vinod Koul
  2016-05-03 16:31 ` Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2016-05-03  9:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Subhransu S. Prusty, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Jeeja KP, Sudip Mukherjee, Arnd Bergmann,
	alsa-devel, linux-kernel, kernel-janitors

On Tue, May 03, 2016 at 10:42:58AM +0300, Dan Carpenter wrote:
> 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

> 
> Fixes: 2889099eb8cd ('ASoC: hdac_hdmi: Register chmap controls and ops')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
> index 3043120..7e7ff1b 100644
> --- a/sound/soc/codecs/hdac_hdmi.c
> +++ b/sound/soc/codecs/hdac_hdmi.c
> @@ -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;

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()
  2016-05-03  9:56 ` Vinod Koul
@ 2016-05-03 16:06   ` Vinod Koul
  0 siblings, 0 replies; 5+ messages in thread
From: Vinod Koul @ 2016-05-03 16:06 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Liam Girdwood, Subhransu S. Prusty, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Jeeja KP, Sudip Mukherjee, Arnd Bergmann,
	alsa-devel, linux-kernel, kernel-janitors, Sachin Mokashi,
	patches.audio

On Tue, May 03, 2016 at 03:26:39PM +0530, Vinod Koul wrote:
> On Tue, May 03, 2016 at 10:42:58AM +0300, Dan Carpenter wrote:
> > 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

Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Sachin Mokashi <sachinx.mokashi@intel.com>

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree
  2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
  2016-05-03  7:58 ` Takashi Sakamoto
  2016-05-03  9:56 ` Vinod Koul
@ 2016-05-03 16:31 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-05-03 16:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Vinod Koul, Sachin Mokashi, Mark Brown, Liam Girdwood,
	Subhransu S. Prusty, alsa-devel, Arnd Bergmann, Vinod Koul,
	linux-kernel, kernel-janitors, Takashi Iwai, Mark Brown,
	Jeeja KP, Sudip Mukherjee

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

>From 8f658815da156a9239b98b34e5ba1d3db71a2f6e Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter@oracle.com>
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewd-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/hdac_hdmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index 0ed39753c871..f1170e060230 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -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;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-03 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03  7:42 [patch] ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc() Dan Carpenter
2016-05-03  7:58 ` Takashi Sakamoto
2016-05-03  9:56 ` Vinod Koul
2016-05-03 16:06   ` Vinod Koul
2016-05-03 16:31 ` Applied "ASoC: hdac_hdmi: Potential NULL deref in hdac_hdmi_get_spk_alloc()" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).