Linux-SPI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug
@ 2021-03-18 10:24 Amit Kumar Mahapatra
  2021-03-18 10:24 ` [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Amit Kumar Mahapatra @ 2021-03-18 10:24 UTC (permalink / raw)
  To: broonie
  Cc: linux-spi, linux-arm-kernel, linux-kernel, git, Amit Kumar Mahapatra

This patch series fixes kernel-doc warnings and stack violation
issues in Zynq qspi driver file
---
Branch: for-next
---
Amit Kumar Mahapatra (1):
  spi: spi-zynq-qspi: Fix kernel-doc warning

Karen Dombroski (1):
  spi: spi-zynq-qspi: Fix stack violation bug

 drivers/spi/spi-zynq-qspi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning
  2021-03-18 10:24 [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
@ 2021-03-18 10:24 ` Amit Kumar Mahapatra
  2021-03-18 13:58   ` Mark Brown
  2021-03-18 10:24 ` [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-04-29 17:15 ` [PATCH 0/2]spi: " Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Amit Kumar Mahapatra @ 2021-03-18 10:24 UTC (permalink / raw)
  To: broonie
  Cc: linux-spi, linux-arm-kernel, linux-kernel, git, Amit Kumar Mahapatra

Fix kernel-doc warning.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
---
 drivers/spi/spi-zynq-qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
index 5d8a5ee62fa2..1acde9e24973 100644
--- a/drivers/spi/spi-zynq-qspi.c
+++ b/drivers/spi/spi-zynq-qspi.c
@@ -367,7 +367,7 @@ static int zynq_qspi_config_op(struct zynq_qspi *xqspi, struct spi_device *spi)
 }

 /**
- * zynq_qspi_setup - Configure the QSPI controller
+ * zynq_qspi_setup_op - Configure the QSPI controller
  * @spi:       Pointer to the spi_device structure
  *
  * Sets the operational mode of QSPI controller for the next QSPI transfer, baud
--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug
  2021-03-18 10:24 [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-03-18 10:24 ` [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
@ 2021-03-18 10:24 ` Amit Kumar Mahapatra
  2021-03-18 13:23   ` Mark Brown
  2021-04-29 17:15 ` [PATCH 0/2]spi: " Mark Brown
  2 siblings, 1 reply; 6+ messages in thread
From: Amit Kumar Mahapatra @ 2021-03-18 10:24 UTC (permalink / raw)
  To: broonie
  Cc: linux-spi, linux-arm-kernel, linux-kernel, git, Karen Dombroski,
	Amit Kumar Mahapatra

From: Karen Dombroski <karen.dombroski@marsbioimaging.com>

When the number of bytes for the op is greater than one, the read could
run off the end of the function stack and cause a crash.

This patch restores the behaviour of safely reading out of the original
opcode location.

Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
 in: zynq_qspi_exec_mem_op+0x1c0/0x2e0
CPU1: stopping
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.9.11-mars-2020.11 #2
Hardware name: Xilinx Zynq Platform
[<c010c15c>] (unwind_backtrace) from [<c0109034>] (show_stack+0x10/0x14)
[<c0109034>] (show_stack) from [<c0591848>] (dump_stack+0xb8/0xd4)
[<c0591848>] (dump_stack) from [<c010aecc>] (handle_IPI+0xe0/0x1a4)
[<c010aecc>] (handle_IPI) from [<c0343890>] (gic_handle_irq+0x84/0x90)
[<c0343890>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/0xa8)
Exception stack(0xef087f58 to 0xef087fa0)
7f40:                                                       00000780 ef7e26f4
7f60: 00000000 c0114380 00000000 00000000 ef086000 c0903eec 00000002 ef087fb8
7f80: c0903f28 00000000 ffffffe8 ef087fa8 c0106824 c0106814 60000013 ffffffff
[<c0100b0c>] (__irq_svc) from [<c0106814>] (arch_cpu_idle+0x1c/0x38)
[<c0106814>] (arch_cpu_idle) from [<c0598d58>] (default_idle_call+0x20/0x28)
[<c0598d58>] (default_idle_call) from [<c013b744>] (do_idle+0x124/0x22c)
[<c013b744>] (do_idle) from [<c013b9bc>] (cpu_startup_entry+0x18/0x1c)
[<c013b9bc>] (cpu_startup_entry) from [<001014ac>] (0x1014ac)

Signed-off-by: Karen Dombroski <karen.dombroski@marsbioimaging.com>
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
---
 drivers/spi/spi-zynq-qspi.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c
index 1acde9e24973..5a3d81c31d04 100644
--- a/drivers/spi/spi-zynq-qspi.c
+++ b/drivers/spi/spi-zynq-qspi.c
@@ -528,18 +528,17 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
        struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master);
        int err = 0, i;
        u8 *tmpbuf;
-       u8 opcode = op->cmd.opcode;

        dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
-               opcode, op->cmd.buswidth, op->addr.buswidth,
+               op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
                op->dummy.buswidth, op->data.buswidth);

        zynq_qspi_chipselect(mem->spi, true);
        zynq_qspi_config_op(xqspi, mem->spi);

-       if (op->cmd.nbytes) {
+       if (op->cmd.opcode) {
                reinit_completion(&xqspi->data_completion);
-               xqspi->txbuf = &opcode;
+               xqspi->txbuf = (u8 *)&op->cmd.opcode;
                xqspi->rxbuf = NULL;
                xqspi->tx_bytes = op->cmd.nbytes;
                xqspi->rx_bytes = op->cmd.nbytes;
--
2.17.1

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug
  2021-03-18 10:24 ` [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
@ 2021-03-18 13:23   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-03-18 13:23 UTC (permalink / raw)
  To: Amit Kumar Mahapatra
  Cc: linux-spi, linux-arm-kernel, linux-kernel, git, Karen Dombroski


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

On Thu, Mar 18, 2021 at 04:24:46AM -0600, Amit Kumar Mahapatra wrote:

> When the number of bytes for the op is greater than one, the read could
> run off the end of the function stack and cause a crash.

> This patch restores the behaviour of safely reading out of the original
> opcode location.

> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted
>  in: zynq_qspi_exec_mem_op+0x1c0/0x2e0
> CPU1: stopping

Please think hard before including complete backtraces in upstream
reports, they are very large and contain almost no useful information
relative to their size so often obscure the relevant content in your
message. If part of the backtrace is usefully illustrative (it often is
for search engines if nothing else) then it's usually better to pull out
the relevant sections.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning
  2021-03-18 10:24 ` [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
@ 2021-03-18 13:58   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-03-18 13:58 UTC (permalink / raw)
  To: Amit Kumar Mahapatra; +Cc: linux-spi, linux-arm-kernel, linux-kernel, git


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

On Thu, Mar 18, 2021 at 04:24:45AM -0600, Amit Kumar Mahapatra wrote:
> Fix kernel-doc warning.
> 
> Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@xilinx.com>
> ---

Applying: spi: spi-zynq-qspi: Fix kernel-doc warning
Using index info to reconstruct a base tree...
error: patch failed: drivers/spi/spi-zynq-qspi.c:367
error: drivers/spi/spi-zynq-qspi.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug
  2021-03-18 10:24 [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
  2021-03-18 10:24 ` [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
  2021-03-18 10:24 ` [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
@ 2021-04-29 17:15 ` Mark Brown
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2021-04-29 17:15 UTC (permalink / raw)
  To: Amit Kumar Mahapatra
  Cc: Mark Brown, linux-arm-kernel, git, linux-spi, linux-kernel

On Thu, 18 Mar 2021 04:24:44 -0600, Amit Kumar Mahapatra wrote:
> This patch series fixes kernel-doc warnings and stack violation
> issues in Zynq qspi driver file

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: spi-zynq-qspi: Fix kernel-doc warning
      commit: 121271f08809e5dc01d15d3e529988ac5d740af6
[2/2] spi: spi-zynq-qspi: Fix stack violation bug
      commit: 6d5ff8e632a4f2389c331e5554cd1c2a9a28c7aa

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 10:24 [PATCH 0/2]spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
2021-03-18 10:24 ` [PATCH 1/2] spi: spi-zynq-qspi: Fix kernel-doc warning Amit Kumar Mahapatra
2021-03-18 13:58   ` Mark Brown
2021-03-18 10:24 ` [PATCH 2/2] spi: spi-zynq-qspi: Fix stack violation bug Amit Kumar Mahapatra
2021-03-18 13:23   ` Mark Brown
2021-04-29 17:15 ` [PATCH 0/2]spi: " Mark Brown

Linux-SPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-spi/0 linux-spi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-spi linux-spi/ https://lore.kernel.org/linux-spi \
		linux-spi@vger.kernel.org
	public-inbox-index linux-spi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-spi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git