From: Krzysztof Kozlowski <krzk@kernel.org>
To: Anton Vasilyev <vasilyev@ispras.ru>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>,
Sangbeom Kim <sbkim73@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: Re: [PATCH v3] ASoC: samsung: i2s: Null pointer dereference on samsung_i2s_remove
Date: Sat, 12 Aug 2017 09:10:51 +0200 [thread overview]
Message-ID: <20170812071051.vslbtrgn732v7hvr@kozik-lap> (raw)
In-Reply-To: <1502456783-2047-1-git-send-email-vasilyev@ispras.ru>
On Fri, Aug 11, 2017 at 04:06:23PM +0300, Anton Vasilyev wrote:
> 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()
> performs pri_dai->sec_dai dereference in any case.
>
> The patch adds sec_dai check on Null before derefence at
> samsung_i2s_remove().
No, I think this patch does not any check.
Best regards,
Krzysztof
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
> ---
> v2: Drop initialization of sec_dai by NULL at samsung_i2s_remove
> as Sylwester Nawrocki suggest.
> ---
> v3: Fix typo in the comment
> ---
> sound/soc/samsung/i2s.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
> index af3ba4d..6f896e3 100644
> --- a/sound/soc/samsung/i2s.c
> +++ b/sound/soc/samsung/i2s.c
> @@ -1376,13 +1376,9 @@ static int samsung_i2s_probe(struct platform_device *pdev)
>
> static int samsung_i2s_remove(struct platform_device *pdev)
> {
> - struct i2s_dai *pri_dai, *sec_dai;
> + struct i2s_dai *pri_dai;
>
> pri_dai = dev_get_drvdata(&pdev->dev);
> - sec_dai = pri_dai->sec_dai;
> -
> - pri_dai->sec_dai = NULL;
> - sec_dai->pri_dai = NULL;
>
> pm_runtime_get_sync(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> --
> 2.7.4
>
prev parent reply other threads:[~2017-08-12 7:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-11 13:06 Anton Vasilyev
2017-08-12 7:10 ` Krzysztof Kozlowski [this message]
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=20170812071051.vslbtrgn732v7hvr@kozik-lap \
--to=krzk@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@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 \
--cc=vasilyev@ispras.ru \
/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®