ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access
diff mbox series

Message ID CAGjHXR2ExzMO3ntwzZy9QUhpuqe-VZAXOucNkXXZK+0XZcaQWQ@mail.gmail.com
State New
Headers show
Series
  • ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer access
Related show

Commit Message

mnlife qiao July 15, 2020, 12:24 a.m. UTC
When snd_soc_card_jack_new is not called or the call fails,
calling this function causes a null pointer access

Signed-off-by: mnlife <mnlife@foxmail.com>
---
 sound/soc/soc-jack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown July 16, 2020, 10:29 p.m. UTC | #1
On Wed, Jul 15, 2020 at 08:24:04AM +0800, mnlife qiao wrote:
> When snd_soc_card_jack_new is not called or the call fails,
> calling this function causes a null pointer access

> --- a/sound/soc/soc-jack.c
> +++ b/sound/soc/soc-jack.c
> @@ -44,7 +44,7 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
> 	unsigned int sync = 0;
> 	int enable;
> 
> -	if (!jack)
> +	if (!jack || !jack->jack)
> 		return;

I'm afraid this still won't apply - there's a text/html version of the
patch, in the text portion tabs have been converted into spaces and it
appears some other issues that mean git am can't understand it.

Patch
diff mbox series

diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 0f1820f36b4d..51b799ee98b7 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -44,7 +44,7 @@  void snd_soc_jack_report(struct snd_soc_jack *jack, int
status, int mask)
        unsigned int sync = 0;
        int enable;

-       if (!jack)
+       if (!jack || !jack->jack)
                return;
        trace_snd_soc_jack_report(jack, mask, status);