Someting is up with the recent linux-yocto-dev patches.

Patch 1 applied to 5.10, but not linux-yocto-dev (5.12.2), patch 2
was fine on both.

I resolved a the conflct for patch 1 on linux-yocto-dev and pushed
it, but double check and re-submit anything missing or fixes.

Bruce


In message: [PATCH][linux-yocto][linux-yocto 
v5.10/standard/sdkv5.4/xlnx-soc][linux-yocto-dev standard/xlnx-soc] mtd: 
spi-nor: Don't parse 4BAIT via Zynq QSPI
on 13/05/2021 Yun Zhou wrote:

> If a flash support 4byte address mode, spi-nor subsystem will let it work
> on 4byte address mode by calling spi_nor_parse_4bait. However, Zynq QSPI
> controller does not support 4byte address mode(please see
> bd78733fffb5720020ae1b7a120d344a6d63af96 upstream).
> 
> So do not parse 4BAIT if the flash is connected to Zynq QSPI.
> 
> Signed-off-by: Yun Zhou <[email protected]>
> ---
>  drivers/mtd/spi-nor/sfdp.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
> index 08de2a2b4452..6db5f55dd9ca 100644
> --- a/drivers/mtd/spi-nor/sfdp.c
> +++ b/drivers/mtd/spi-nor/sfdp.c
> @@ -1178,11 +1178,17 @@ int spi_nor_parse_sfdp(struct spi_nor *nor,
>               case SFDP_SECTOR_MAP_ID:
>                       err = spi_nor_parse_smpt(nor, param_header, params);
>                       break;
> -
> +#ifdef CONFIG_OF
>               case SFDP_4BAIT_ID:
> -                     err = spi_nor_parse_4bait(nor, param_header, params);
> +                     {
> +                             struct device_node *np = 
> spi_nor_get_flash_node(nor);
> +                             struct device_node *np_spi = 
> of_get_next_parent(np);
> +                             if (of_property_match_string(np_spi, 
> "compatible",
> +                                                     "xlnx,zynq-qspi-1.0") < 
> 0)
> +                                     err = spi_nor_parse_4bait(nor, 
> param_header, params);
> +                     }
>                       break;
> -
> +#endif
>               default:
>                       break;
>               }
> -- 
> 2.26.1
> 

In message: [PATCH][linux-yocto][linux-yocto 
v5.10/standard/sdkv5.4/xlnx-soc][linux-yocto-dev standard/xlnx-soc] mtd: 
spi-nor: fix stack corruption in spi_nor_lock
on 13/05/2021 Yun Zhou wrote:

> If try to lock spinor flash in parallel, spi_nor_read_sr will read 2
> bytes, but spi_nor_lock only provide 1 byte buffer on stask, then stack
> will be corrupted. We can enable CONFIG_STACKPROTECTOR to get the Oops:
> 
> Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: 
> spi_nor_lock+0x168/0x188
> CPU: 0 PID: 375 Comm: flash_lock Not tainted 5.10.32-yocto-standard #1
> Hardware name: Xilinx Zynq Platform
> [<801105f0>] (unwind_backtrace) from [<8010ac28>] (show_stack+0x18/0x1c)
> [<8010ac28>] (show_stack) from [<80a91880>] (dump_stack+0x7c/0x98)
> [<80a91880>] (dump_stack) from [<80a8b880>] (panic+0x10c/0x324)
> [<80a8b880>] (panic) from [<80a97658>] (__stack_chk_fail+0x10/0x14)
> [<80a97658>] (__stack_chk_fail) from [<80732d68>] (spi_nor_lock+0x168/0x188)
> [<80732d68>] (spi_nor_lock) from [<8072c078>] (mtdchar_ioctl+0x7bc/0xd70)
> [<8072c078>] (mtdchar_ioctl) from [<8072c660>] 
> (mtdchar_unlocked_ioctl+0x34/0x4c)
> [<8072c660>] (mtdchar_unlocked_ioctl) from [<802d0b14>] (vfs_ioctl+0x28/0x3c)
> [<802d0b14>] (vfs_ioctl) from [<802d1504>] (sys_ioctl+0xe0/0x780)
> [<802d1504>] (sys_ioctl) from [<80100060>] (ret_fast_syscall+0x0/0x54)
> 
> Signed-off-by: Yun Zhou <[email protected]>
> ---
>  drivers/mtd/spi-nor/core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index d94b8ee9099f..63023628bff6 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2105,7 +2105,7 @@ static const struct spi_nor_locking_ops 
> spi_nor_sr_locking_ops = {
>  static int spi_nor_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
>  {
>       struct spi_nor *nor = mtd_to_spi_nor(mtd);
> -     u8 status;
> +     u8 status[2];
>       u8 lock_bits;
>       int ret;
>  
> @@ -2130,16 +2130,16 @@ static int spi_nor_lock(struct mtd_info *mtd, loff_t 
> ofs, uint64_t len)
>       if (ret)
>               goto err;
>  
> -     ret = spi_nor_read_sr(nor, &status);
> +     ret = spi_nor_read_sr(nor, status);
>       if (ret)
>               goto err;
>  
>       lock_bits = min_protected_area_including_offset(nor, ofs);
>  
>       /* Only modify protection if it will not unlock other areas */
> -     if (lock_bits > bp_bits_from_sr(nor, status)) {
> +     if (lock_bits > bp_bits_from_sr(nor, status[0])) {
>               nor->is_lock = 1;
> -             ret = write_sr_modify_protection(nor, status, lock_bits);
> +             ret = write_sr_modify_protection(nor, status[0], lock_bits);
>       } else {
>               dev_err(nor->dev, "trying to unlock already locked area\n");
>       }
> -- 
> 2.26.1
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9875): 
https://lists.yoctoproject.org/g/linux-yocto/message/9875
Mute This Topic: https://lists.yoctoproject.org/mt/82816047/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to