All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Chuanhong Guo <gch981213@gmail.com>
Cc: linux-spi@vger.kernel.org, bayi.cheng@mediatek.com,
	stable@vger.kernel.org, Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] spi: spi-mtk-nor: fix timeout calculation overflow
Date: Tue, 22 Sep 2020 13:01:12 +0100	[thread overview]
Message-ID: <20200922120112.GS4792@sirena.org.uk> (raw)
In-Reply-To: <20200922114905.2942859-1-gch981213@gmail.com>

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

On Tue, Sep 22, 2020 at 07:49:02PM +0800, Chuanhong Guo wrote:

>  		if ((op->data.dir == SPI_MEM_DATA_IN) &&
>  		    mtk_nor_match_read(op)) {
> +			// limit size to prevent timeout calculation overflow
> +			if (op->data.nbytes > 0x400000)
> +				op->data.nbytes = 0x400000;

If there's a limit on transfer sizes there should also be a
max_transfer_size or max_message_size set (which we should pay attention
to in the core for flash stuff but IIRC we didn't do that yet).

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

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Chuanhong Guo <gch981213@gmail.com>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mediatek@lists.infradead.org,
	bayi.cheng@mediatek.com,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] spi: spi-mtk-nor: fix timeout calculation overflow
Date: Tue, 22 Sep 2020 13:01:12 +0100	[thread overview]
Message-ID: <20200922120112.GS4792@sirena.org.uk> (raw)
In-Reply-To: <20200922114905.2942859-1-gch981213@gmail.com>


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

On Tue, Sep 22, 2020 at 07:49:02PM +0800, Chuanhong Guo wrote:

>  		if ((op->data.dir == SPI_MEM_DATA_IN) &&
>  		    mtk_nor_match_read(op)) {
> +			// limit size to prevent timeout calculation overflow
> +			if (op->data.nbytes > 0x400000)
> +				op->data.nbytes = 0x400000;

If there's a limit on transfer sizes there should also be a
max_transfer_size or max_message_size set (which we should pay attention
to in the core for flash stuff but IIRC we didn't do that yet).

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

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@kernel.org>
To: Chuanhong Guo <gch981213@gmail.com>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mediatek@lists.infradead.org,
	bayi.cheng@mediatek.com,
	Matthias Brugger <matthias.bgg@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] spi: spi-mtk-nor: fix timeout calculation overflow
Date: Tue, 22 Sep 2020 13:01:12 +0100	[thread overview]
Message-ID: <20200922120112.GS4792@sirena.org.uk> (raw)
In-Reply-To: <20200922114905.2942859-1-gch981213@gmail.com>


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

On Tue, Sep 22, 2020 at 07:49:02PM +0800, Chuanhong Guo wrote:

>  		if ((op->data.dir == SPI_MEM_DATA_IN) &&
>  		    mtk_nor_match_read(op)) {
> +			// limit size to prevent timeout calculation overflow
> +			if (op->data.nbytes > 0x400000)
> +				op->data.nbytes = 0x400000;

If there's a limit on transfer sizes there should also be a
max_transfer_size or max_message_size set (which we should pay attention
to in the core for flash stuff but IIRC we didn't do that yet).

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

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-22 12:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 11:49 [PATCH v2] spi: spi-mtk-nor: fix timeout calculation overflow Chuanhong Guo
2020-09-22 11:49 ` Chuanhong Guo
2020-09-22 11:49 ` Chuanhong Guo
2020-09-22 12:01 ` Mark Brown [this message]
2020-09-22 12:01   ` Mark Brown
2020-09-22 12:01   ` Mark Brown
2020-09-22 12:18   ` Chuanhong Guo
2020-09-22 12:18     ` Chuanhong Guo
2020-09-22 12:18     ` Chuanhong Guo
2020-09-22 12:37   ` Chuanhong Guo
2020-09-22 12:37     ` Chuanhong Guo
2020-09-22 12:37     ` Chuanhong Guo
2020-09-25 20:42 ` Mark Brown
2020-09-25 20:42   ` Mark Brown
2020-09-25 20:42   ` Mark Brown

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=20200922120112.GS4792@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=bayi.cheng@mediatek.com \
    --cc=gch981213@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=stable@vger.kernel.org \
    /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.