* [PATCH] nvmem: imx-ocotp: fix MAC address byte length
@ 2025-06-23 7:08 Steffen Bätz
2025-06-23 7:19 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Steffen Bätz @ 2025-06-23 7:08 UTC (permalink / raw)
Cc: Steffen Bätz, Srinivas Kandagatla, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Dmitry Baryshkov,
Greg Kroah-Hartman, imx, linux-arm-kernel, linux-kernel
The commit "13bcd440f2ff nvmem: core: verify cell's raw_len" caused an
extension of the "mac-address" cell from 6 to 8 bytes due to word_size
of 4 bytes.
Thus, the required byte swap for the mac-address of the full buffer length,
caused an trucation of the read mac-address.
From the original address 70:B3:D5:14:E9:0E to 00:00:70:B3:D5:14
After swapping only the first 6 bytes, the mac-address is correctly passed
to the upper layers.
Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
Signed-off-by: Steffen Bätz <steffen@innosonix.de>
---
drivers/nvmem/imx-ocotp-ele.c | 2 ++
drivers/nvmem/imx-ocotp.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index ca6dd71d8a2e..3af7968f5a34 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -119,6 +119,8 @@ static int imx_ocotp_cell_pp(void *context, const char *id, int index,
/* Deal with some post processing of nvmem cell data */
if (id && !strcmp(id, "mac-address"))
+ if (bytes > 6)
+ bytes = 6;
for (i = 0; i < bytes / 2; i++)
swap(buf[i], buf[bytes - i - 1]);
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 79dd4fda0329..63e9974d9618 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -228,6 +228,8 @@ static int imx_ocotp_cell_pp(void *context, const char *id, int index,
/* Deal with some post processing of nvmem cell data */
if (id && !strcmp(id, "mac-address"))
+ if (bytes > 6)
+ bytes = 6;
for (i = 0; i < bytes / 2; i++)
swap(buf[i], buf[bytes - i - 1]);
--
2.43.0
--
*innosonix GmbH*
Hauptstr. 35
96482 Ahorn
central: +49 9561 7459980
www.innosonix.de <http://www.innosonix.de>
innosonix GmbH
Geschäftsführer:
Markus Bätz, Steffen Bätz
USt.-IdNr / VAT-Nr.: DE266020313
EORI-Nr.:
DE240121536680271
HRB 5192 Coburg
WEEE-Reg.-Nr. DE88021242
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nvmem: imx-ocotp: fix MAC address byte length
2025-06-23 7:08 [PATCH] nvmem: imx-ocotp: fix MAC address byte length Steffen Bätz
@ 2025-06-23 7:19 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2025-06-23 7:19 UTC (permalink / raw)
To: Steffen Bätz
Cc: Srinivas Kandagatla, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Dmitry Baryshkov, imx,
linux-arm-kernel, linux-kernel
On Mon, Jun 23, 2025 at 09:08:49AM +0200, Steffen Bätz wrote:
> The commit "13bcd440f2ff nvmem: core: verify cell's raw_len" caused an
> extension of the "mac-address" cell from 6 to 8 bytes due to word_size
> of 4 bytes.
>
> Thus, the required byte swap for the mac-address of the full buffer length,
> caused an trucation of the read mac-address.
> >From the original address 70:B3:D5:14:E9:0E to 00:00:70:B3:D5:14
>
> After swapping only the first 6 bytes, the mac-address is correctly passed
> to the upper layers.
>
> Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
> Signed-off-by: Steffen Bätz <steffen@innosonix.de>
> ---
> drivers/nvmem/imx-ocotp-ele.c | 2 ++
> drivers/nvmem/imx-ocotp.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
> index ca6dd71d8a2e..3af7968f5a34 100644
> --- a/drivers/nvmem/imx-ocotp-ele.c
> +++ b/drivers/nvmem/imx-ocotp-ele.c
> @@ -119,6 +119,8 @@ static int imx_ocotp_cell_pp(void *context, const char *id, int index,
>
> /* Deal with some post processing of nvmem cell data */
> if (id && !strcmp(id, "mac-address"))
> + if (bytes > 6)
> + bytes = 6;
> for (i = 0; i < bytes / 2; i++)
> swap(buf[i], buf[bytes - i - 1]);
>
> diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
> index 79dd4fda0329..63e9974d9618 100644
> --- a/drivers/nvmem/imx-ocotp.c
> +++ b/drivers/nvmem/imx-ocotp.c
> @@ -228,6 +228,8 @@ static int imx_ocotp_cell_pp(void *context, const char *id, int index,
>
> /* Deal with some post processing of nvmem cell data */
> if (id && !strcmp(id, "mac-address"))
> + if (bytes > 6)
> + bytes = 6;
> for (i = 0; i < bytes / 2; i++)
> swap(buf[i], buf[bytes - i - 1]);
>
> --
> 2.43.0
>
>
> --
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-23 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 7:08 [PATCH] nvmem: imx-ocotp: fix MAC address byte length Steffen Bätz
2025-06-23 7:19 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).