[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <296be5ed-47a6-4701-a7f5-968e9e65b5f8@linaro.org>
Date: Fri, 8 Dec 2023 11:41:10 +0000
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: Yanxin Huang <yanxin.huang@...soc.com>,
Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>
Cc: linux-kernel@...r.kernel.org,
huang yanxin <yanxin.huang07@...il.com>,
Wenming Wu <wenming.wu@...soc.com>
Subject: Re: [PATCH 1/3] nvmem: sprd: Fix memory overflow issue during memcpy
operation in efuse driver
thanks for the patch.
On 08/12/2023 06:11, Yanxin Huang wrote:
> The efuse driver didn't determine the size of bytes, resulting in memory
> overflow during memcpy operation.
>
> Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
Please add CC Stable for all the fixes.
> Signed-off-by: Yanxin Huang <yanxin.huang@...soc.com>
> ---
> drivers/nvmem/sprd-efuse.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
> index bb3105f3291f..24b63620d217 100644
> --- a/drivers/nvmem/sprd-efuse.c
> +++ b/drivers/nvmem/sprd-efuse.c
> @@ -311,6 +311,7 @@ static int sprd_efuse_read(void *context, u32 offset, void *val, size_t bytes)
> ret = sprd_efuse_raw_read(efuse, index, &data, blk_double);
> if (!ret) {
> data >>= blk_offset;
> + bytes = bytes > sizeof(data) ? sizeof(data) : bytes;
looks like sprd_efuse_read is only reading upto 4 bytes max, and
silently ignoring reading requests data after 4 bytes.
Is this working because consumers so far only requested 4 bytes and less ?
does dumping nvmem sysfs actually show real content in your case?
--srini
> memcpy(val, &data, bytes);
> }
>
Powered by blists - more mailing lists