All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus: sunxi-rsb: Always check register address validity
@ 2026-03-01 14:49 Andrey Skvortsov
  2026-03-02 18:43 ` Jernej Škrabec
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrey Skvortsov @ 2026-03-01 14:49 UTC (permalink / raw)
  To: Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, linux-arm-kernel,
	linux-sunxi, linux-kernel
  Cc: Andrey Skvortsov

From: Samuel Holland <samuel@sholland.org>

The register address was already validated for read operations in
regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
have the same set of possible addresses, and the address is being truncated
from u32 to u8 here as well, so the same check is needed.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
---
 drivers/bus/sunxi-rsb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index b4f2c64ac1810..daf0ea563e477 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -445,6 +445,9 @@ static int regmap_sunxi_rsb_reg_write(void *context, unsigned int reg,
 	struct sunxi_rsb_ctx *ctx = context;
 	struct sunxi_rsb_device *rdev = ctx->rdev;
 
+	if (reg > 0xff)
+		return -EINVAL;
+
 	return sunxi_rsb_write(rdev->rsb, rdev->rtaddr, reg, &val, ctx->size);
 }
 
-- 
2.51.0



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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-03-01 14:49 [PATCH] bus: sunxi-rsb: Always check register address validity Andrey Skvortsov
@ 2026-03-02 18:43 ` Jernej Škrabec
  2026-03-14  7:33 ` Chen-Yu Tsai
  2026-05-15  2:45 ` Chen-Yu Tsai
  2 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2026-03-02 18:43 UTC (permalink / raw)
  To: Chen-Yu Tsai, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel, Andrey Skvortsov
  Cc: Andrey Skvortsov

Dne nedelja, 1. marec 2026 ob 15:49:39 Srednjeevropski standardni čas je Andrey Skvortsov napisal(a):
> From: Samuel Holland <samuel@sholland.org>
> 
> The register address was already validated for read operations in
> regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
> have the same set of possible addresses, and the address is being truncated
> from u32 to u8 here as well, so the same check is needed.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej




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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-03-01 14:49 [PATCH] bus: sunxi-rsb: Always check register address validity Andrey Skvortsov
  2026-03-02 18:43 ` Jernej Škrabec
@ 2026-03-14  7:33 ` Chen-Yu Tsai
  2026-05-14 21:17   ` Andrey Skvortsov
  2026-05-15  2:45 ` Chen-Yu Tsai
  2 siblings, 1 reply; 6+ messages in thread
From: Chen-Yu Tsai @ 2026-03-14  7:33 UTC (permalink / raw)
  To: Andrey Skvortsov
  Cc: Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel

On Sun, Mar 1, 2026 at 10:50 PM Andrey Skvortsov
<andrej.skvortzov@gmail.com> wrote:
>
> From: Samuel Holland <samuel@sholland.org>
>
> The register address was already validated for read operations in
> regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
> have the same set of possible addresses, and the address is being truncated
> from u32 to u8 here as well, so the same check is needed.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>

Should probably have:

Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
Serial Bus")

I will added (via b4) when applying.

Reviewed-by: Chen-Yu Tsai <wens@kernel.org>


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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-03-14  7:33 ` Chen-Yu Tsai
@ 2026-05-14 21:17   ` Andrey Skvortsov
  2026-05-15  2:44     ` Chen-Yu Tsai
  0 siblings, 1 reply; 6+ messages in thread
From: Andrey Skvortsov @ 2026-05-14 21:17 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel


On 26-03-14 15:33, Chen-Yu Tsai wrote:
> On Sun, Mar 1, 2026 at 10:50 PM Andrey Skvortsov
> <andrej.skvortzov@gmail.com> wrote:
> >
> > From: Samuel Holland <samuel@sholland.org>
> >
> > The register address was already validated for read operations in
> > regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
> > have the same set of possible addresses, and the address is being truncated
> > from u32 to u8 here as well, so the same check is needed.
> >
> > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> 
> Should probably have:
> 
> Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
> Serial Bus")
> 
> I will added (via b4) when applying.
> 
> Reviewed-by: Chen-Yu Tsai <wens@kernel.org>

Hi,

do I need to update and resend this patch?

-- 
Best regards,
Andrey Skvortsov

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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-05-14 21:17   ` Andrey Skvortsov
@ 2026-05-15  2:44     ` Chen-Yu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2026-05-15  2:44 UTC (permalink / raw)
  To: Andrey Skvortsov, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	linux-arm-kernel, linux-sunxi, linux-kernel

On Fri, May 15, 2026 at 5:17 AM Andrey Skvortsov
<andrej.skvortzov@gmail.com> wrote:
>
>
> On 26-03-14 15:33, Chen-Yu Tsai wrote:
> > On Sun, Mar 1, 2026 at 10:50 PM Andrey Skvortsov
> > <andrej.skvortzov@gmail.com> wrote:
> > >
> > > From: Samuel Holland <samuel@sholland.org>
> > >
> > > The register address was already validated for read operations in
> > > regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
> > > have the same set of possible addresses, and the address is being truncated
> > > from u32 to u8 here as well, so the same check is needed.
> > >
> > > Signed-off-by: Samuel Holland <samuel@sholland.org>
> > > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
> >
> > Should probably have:
> >
> > Fixes: d787dcdb9c8f ("bus: sunxi-rsb: Add driver for Allwinner Reduced
> > Serial Bus")
> >
> > I will added (via b4) when applying.
> >
> > Reviewed-by: Chen-Yu Tsai <wens@kernel.org>
>
> Hi,
>
> do I need to update and resend this patch?

Sorry this fell through the cracks. I've applied it now.


ChenYu

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

* Re: [PATCH] bus: sunxi-rsb: Always check register address validity
  2026-03-01 14:49 [PATCH] bus: sunxi-rsb: Always check register address validity Andrey Skvortsov
  2026-03-02 18:43 ` Jernej Škrabec
  2026-03-14  7:33 ` Chen-Yu Tsai
@ 2026-05-15  2:45 ` Chen-Yu Tsai
  2 siblings, 0 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2026-05-15  2:45 UTC (permalink / raw)
  To: Jernej Skrabec, Samuel Holland, linux-arm-kernel, linux-sunxi,
	linux-kernel, Chen-Yu Tsai, Andrey Skvortsov

On Sun, 01 Mar 2026 17:49:39 +0300, Andrey Skvortsov wrote:
> The register address was already validated for read operations in
> regmap_sunxi_rsb_reg_read before being truncated to a u8. Write operations
> have the same set of possible addresses, and the address is being truncated
> from u32 to u8 here as well, so the same check is needed.
> 
> 

Applied to sunxi/fixes-for-7.1 in local tree, thanks!

[1/1] bus: sunxi-rsb: Always check register address validity
      commit: 322f01103323199cdd9eff8cb6aacbf1248ce36e

Best regards,
-- 
Chen-Yu Tsai <wens@kernel.org>


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

end of thread, other threads:[~2026-05-15  2:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01 14:49 [PATCH] bus: sunxi-rsb: Always check register address validity Andrey Skvortsov
2026-03-02 18:43 ` Jernej Škrabec
2026-03-14  7:33 ` Chen-Yu Tsai
2026-05-14 21:17   ` Andrey Skvortsov
2026-05-15  2:44     ` Chen-Yu Tsai
2026-05-15  2:45 ` Chen-Yu Tsai

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.