lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231017162132.361be2c3@xps-13>
Date:   Tue, 17 Oct 2023 16:21:32 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Frank Li <Frank.Li@....com>
Cc:     conor.culhane@...vaco.com, alexandre.belloni@...tlin.com,
        joe@...ches.com, linux-i3c@...ts.infradead.org,
        linux-kernel@...r.kernel.org, imx@...ts.linux.dev
Subject: Re: [PATCH 2/6] i3c: master: svc: fix wrong data return when IBI
 happen during start frame

Hi Frank,

Frank.Li@....com wrote on Mon, 16 Oct 2023 11:32:28 -0400:

>      ┌─────┐     ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┏──┐  ┌─────
> SCL: ┘     └─────┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┛  └──┘
>      ───┐                       ┌─────┐     ┌─────┐     ┌───────────┐
> SDA:    └───────────────────────┘     └─────┘     └─────┘           └─────
>      xxx╱    ╲╱                                        ╲╱    ╲╱    ╲╱    ╲
>    : xxx╲IBI ╱╲               Addr(0x0a)               ╱╲ RW ╱╲NACK╱╲ S  ╱
> 
> In-Band Interrupt (IBI) occurred and IBI work thread may not to be

If an In-Band...	occurs and the IBI work thread is not
immediately scheduled, when svc... initiates an I3C transfer and
attempts...

> scheduled. When svc_i3c_master_priv_xfers() initiates the I3C transfer
> frame and attempts to send address 0x7e, the target interprets it as an
> IBI handler and returns the target address 0x0a.
> 
> However, svc_i3c_master_priv_xfers() does not handle this case and proceeds
> with other transfers, resulting in incorrect data being returned.
> 
> IBIWON check has been added in svc_i3c_master_xfer(). In case this

Add IBIWON check in svc_...

> situation occurs, a failure is now returned to the driver.

			return a failure...

> 
> Fixes: dd3c52846d59 ("i3c: master: svc: Add Silvaco I3C master driver")
> Cc: stable@...r.kernel.org
> Signed-off-by: Frank Li <Frank.Li@....com>
> ---
>  drivers/i3c/master/svc-i3c-master.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
> index ebdb3ea1af9d..0f57a5f75e39 100644
> --- a/drivers/i3c/master/svc-i3c-master.c
> +++ b/drivers/i3c/master/svc-i3c-master.c
> @@ -1009,6 +1009,9 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
>  	u32 reg;
>  	int ret;
>  
> +	/* clean SVC_I3C_MINT_IBIWON w1c bits */
> +	writel(SVC_I3C_MINT_IBIWON, master->regs + SVC_I3C_MSTATUS);
> +
>  	writel(SVC_I3C_MCTRL_REQUEST_START_ADDR |
>  	       xfer_type |
>  	       SVC_I3C_MCTRL_IBIRESP_NACK |
> @@ -1027,6 +1030,23 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
>  		goto emit_stop;
>  	}
>  
> +	/*
> +	 * According to I3C spec ver 1.1.1, 5.1.2.2.3 Consequence of Controller Starting a Frame
> +	 * with I3C Target Address.
> +	 *
> +	 * The I3C Controller normally should start a Frame, the Address may be arbitrated, and so
> +	 * the Controller shall monitor to see whether an In-Band Interrupt request, a Controller
> +	 * Role Request (i.e., Secondary Controller requests to become the Active Controller), or
> +	 * a Hot-Join Request has been made.
> +	 *
> +	 * If missed IBIWON check, the wrong data will be return. When IBIWON happen, return falure
> +	 * and yeild the above events handler.

Typos: yeild and falure

> +	 */
> +	if (SVC_I3C_MSTATUS_IBIWON(reg)) {
> +		ret = -ENXIO;
> +		goto emit_stop;
> +	}
> +
>  	if (rnw)
>  		ret = svc_i3c_master_read(master, in, xfer_len);
>  	else

With all the typos fixed:

Reviewed-by: Miquel Raynal <miquel.raynal@...tlin.com>

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ