mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Vasilyev <vasilyev@ispras.ru>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Anton Vasilyev <vasilyev@ispras.ru>,
	Sangbeom Kim <sbkim73@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: [PATCH] ASoC: samsung: i2s: Null pointer dereference on samsung_i2s_remove
Date: Thu, 10 Aug 2017 18:56:39 +0300	[thread overview]
Message-ID: <1502380599-13535-1-git-send-email-vasilyev@ispras.ru> (raw)

If (quirks & QUIRK_SEC_DAI == 0) then samsung_i2s_probe() doesn't allocate
sec_dai and pri_dai->sec_dai remains Null, but samsung_i2s_remove()
permorms pri_dai->sec_dai dereference in any case.

The patch adds sec_dai check on Null before derefence at
samsung_i2s_remove().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
---
 sound/soc/samsung/i2s.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index af3ba4d..6beeea8 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1382,7 +1382,8 @@ static int samsung_i2s_remove(struct platform_device *pdev)
 	sec_dai = pri_dai->sec_dai;
 
 	pri_dai->sec_dai = NULL;
-	sec_dai->pri_dai = NULL;
+	if (sec_dai)
+		sec_dai->pri_dai = NULL;
 
 	pm_runtime_get_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-- 
2.7.4

             reply	other threads:[~2017-08-10 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170810155722epcas3p231f6d4733d933b10461db96d9065674a@epcas3p2.samsung.com>
2017-08-10 15:56 ` Anton Vasilyev [this message]
2017-08-10 16:23   ` Sylwester Nawrocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502380599-13535-1-git-send-email-vasilyev@ispras.ru \
    --to=vasilyev@ispras.ru \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=krzk@kernel.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=s.nawrocki@samsung.com \
    --cc=sbkim73@samsung.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®