All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	alsa-devel@alsa-project.org, bgoswami@codeaurora.org,
	rohkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org,
	plai@codeaurora.org, spatakok@qti.qualcomm.com,
	lgirdwood@gmail.com, tiwai@suse.com, david.brown@linaro.org,
	robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org,
	gregkh@linuxfoundation.org, andy.gross@linaro.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 09/24] ASoC: qdsp6: q6afe: Add q6afe driver
Date: Thu, 17 May 2018 15:55:44 +0900	[thread overview]
Message-ID: <20180517065544.GO20254@sirena.org.uk> (raw)
In-Reply-To: <20180509125635.5653-10-srinivas.kandagatla@linaro.org>


[-- Attachment #1.1: Type: text/plain, Size: 821 bytes --]

On Wed, May 09, 2018 at 01:56:20PM +0100, Srinivas Kandagatla wrote:

> +static struct q6afe_port *afe_find_port(struct q6afe *afe, int token)
> +{
> +	struct q6afe_port *p = NULL;
> +	struct q6afe_port *ret = NULL;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&afe->port_list_lock, flags);
> +	list_for_each_entry(p, &afe->port_list, node)
> +		if (p->token == token) {
> +			ret = p;
> +			break;
> +		}
> +
> +	spin_unlock_irqrestore(&afe->port_list_lock, flags);
> +	return ret;

This lock only protects the list, it does nothing to ensure that the
port we look up is still valid by the time we return to the caller.
That means we won't crash during list traversal but does nothing to
ensure we won't crash immediately afterwards if the port is deallocated
just after we look it up.  What stops that happening?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: andy.gross@linaro.org, linux-arm-msm@vger.kernel.org,
	alsa-devel@alsa-project.org, robh+dt@kernel.org,
	bgoswami@codeaurora.org, gregkh@linuxfoundation.org,
	david.brown@linaro.org, mark.rutland@arm.com,
	lgirdwood@gmail.com, plai@codeaurora.org, tiwai@suse.com,
	perex@perex.cz, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, rohkumar@qti.qualcomm.com,
	spatakok@qti.qualcomm.com
Subject: Re: [PATCH v8 09/24] ASoC: qdsp6: q6afe: Add q6afe driver
Date: Thu, 17 May 2018 15:55:44 +0900	[thread overview]
Message-ID: <20180517065544.GO20254@sirena.org.uk> (raw)
In-Reply-To: <20180509125635.5653-10-srinivas.kandagatla@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 821 bytes --]

On Wed, May 09, 2018 at 01:56:20PM +0100, Srinivas Kandagatla wrote:

> +static struct q6afe_port *afe_find_port(struct q6afe *afe, int token)
> +{
> +	struct q6afe_port *p = NULL;
> +	struct q6afe_port *ret = NULL;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&afe->port_list_lock, flags);
> +	list_for_each_entry(p, &afe->port_list, node)
> +		if (p->token == token) {
> +			ret = p;
> +			break;
> +		}
> +
> +	spin_unlock_irqrestore(&afe->port_list_lock, flags);
> +	return ret;

This lock only protects the list, it does nothing to ensure that the
port we look up is still valid by the time we return to the caller.
That means we won't crash during list traversal but does nothing to
ensure we won't crash immediately afterwards if the port is deallocated
just after we look it up.  What stops that happening?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: broonie@kernel.org (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 09/24] ASoC: qdsp6: q6afe: Add q6afe driver
Date: Thu, 17 May 2018 15:55:44 +0900	[thread overview]
Message-ID: <20180517065544.GO20254@sirena.org.uk> (raw)
In-Reply-To: <20180509125635.5653-10-srinivas.kandagatla@linaro.org>

On Wed, May 09, 2018 at 01:56:20PM +0100, Srinivas Kandagatla wrote:

> +static struct q6afe_port *afe_find_port(struct q6afe *afe, int token)
> +{
> +	struct q6afe_port *p = NULL;
> +	struct q6afe_port *ret = NULL;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&afe->port_list_lock, flags);
> +	list_for_each_entry(p, &afe->port_list, node)
> +		if (p->token == token) {
> +			ret = p;
> +			break;
> +		}
> +
> +	spin_unlock_irqrestore(&afe->port_list_lock, flags);
> +	return ret;

This lock only protects the list, it does nothing to ensure that the
port we look up is still valid by the time we return to the caller.
That means we won't crash during list traversal but does nothing to
ensure we won't crash immediately afterwards if the port is deallocated
just after we look it up.  What stops that happening?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180517/2294767d/attachment-0001.sig>

  reply	other threads:[~2018-05-17  6:55 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-09 12:56 [PATCH v8 00/24] ASoC: qcom: Add support to QDSP based Audio Srinivas Kandagatla
2018-05-09 12:56 ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 01/24] soc: qcom dt-bindings: Add APR bus bindings Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 02/24] soc: qcom: Add APR bus driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 03/24] ASoC: qdsp6: dt-bindings: Add q6core dt bindings Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-11  3:18   ` Applied "ASoC: qdsp6: dt-bindings: Add q6core dt bindings" to the asoc tree Mark Brown
2018-05-11  3:18     ` Mark Brown
2018-05-11  3:18     ` Mark Brown
2018-05-09 12:56 ` [PATCH v8 04/24] ASoC: qdsp6: dt-bindings: Add q6afe dt bindings Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 05/24] ASoC: qdsp6: dt-bindings: Add q6adm " Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 06/24] ASoC: qdsp6: dt-bindings: Add q6asm " Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 07/24] ASoC: qdsp6: q6common: Add qdsp6 helper functions Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 08/24] ASoC: qdsp6: q6core: Add q6core driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-15  7:44   ` Banajit Goswami
2018-05-15  7:44     ` Banajit Goswami
2018-05-17 16:38   ` Applied "ASoC: qdsp6: q6core: Add q6core driver" to the asoc tree Mark Brown
2018-05-17 16:38     ` Mark Brown
2018-05-17 16:38     ` Mark Brown
2018-05-09 12:56 ` [PATCH v8 09/24] ASoC: qdsp6: q6afe: Add q6afe driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-17  6:55   ` Mark Brown [this message]
2018-05-17  6:55     ` Mark Brown
2018-05-17  6:55     ` Mark Brown
2018-05-17 17:10     ` Srinivas Kandagatla
2018-05-17 17:10       ` Srinivas Kandagatla
2018-05-17 17:23       ` Mark Brown
2018-05-17 17:23         ` Mark Brown
2018-05-17 17:23         ` Mark Brown
2018-05-17 17:53         ` Srinivas Kandagatla
2018-05-17 17:53           ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 10/24] ASoC: qdsp6: qdafe: Add SLIMBus port Support Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 11/24] ASoC: qdsp6: q6afe: Add support to MI2S ports Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 12/24] ASoC: qdsp6: q6afe: Add support to MI2S sysclks Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 13/24] ASoC: qdsp6: q6adm: Add q6adm driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 14/24] ASoC: qdsp6: q6asm: Add q6asm driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 15/24] ASoC: qdsp6: q6asm: Add support to memory map and unmap Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 16/24] ASoC: qdsp6: q6asm: Add support to audio stream apis Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 17/24] ASoC: qdsp6: q6routing: Add q6routing driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 18/24] ASoC: qdsp6: q6routing: Add support to all SLIMBus Mixers Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 19/24] ASoC: qdsp6: q6routing: Add support to MI2S Mixers Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 20/24] ASoC: qdsp6: q6afe: Add q6afe dai driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-21 15:47   ` Applied "ASoC: qdsp6: q6afe: Add q6afe dai driver" to the asoc tree Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-09 12:56 ` [PATCH v8 21/24] ASoC: qdsp6: q6asm: Add q6asm dai driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-21 15:47   ` Applied "ASoC: qdsp6: q6asm: Add q6asm dai driver" to the asoc tree Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-09 12:56 ` [PATCH v8 22/24] ASoC: qdsp6: dt-bindings: Add apq8096 machine bindings Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-09 12:56 ` [PATCH v8 23/24] ASoC: qcom: apq8096: Add db820c machine driver Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla
2018-05-15  8:00   ` Banajit Goswami
2018-05-15  8:00     ` Banajit Goswami
2018-05-21 15:47   ` Applied "ASoC: qcom: apq8096: Add db820c machine driver" to the asoc tree Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-21 15:47     ` Mark Brown
2018-05-09 12:56 ` [PATCH v8 24/24] MAINTAINERS: Add myself as co-maintainer of qcom audio Srinivas Kandagatla
2018-05-09 12:56   ` Srinivas Kandagatla

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=20180517065544.GO20254@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andy.gross@linaro.org \
    --cc=bgoswami@codeaurora.org \
    --cc=david.brown@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=plai@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=rohkumar@qti.qualcomm.com \
    --cc=spatakok@qti.qualcomm.com \
    --cc=srinivas.kandagatla@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.