* Re: [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers. [not found] <20230728122416.17782-1-lianglixuehao@126.com> @ 2023-07-31 4:21 ` Joel Stanley [not found] ` <CAARXrtmZbu3aabYJkEc25rHymRHDX4=zNdecHAs3LnQ259RkPg@mail.gmail.com> 2023-08-05 10:10 ` Andi Shyti 1 sibling, 1 reply; 3+ messages in thread From: Joel Stanley @ 2023-07-31 4:21 UTC (permalink / raw) To: Lixue Liang, Eddie James Cc: brendan.higgins, benh, p.zabel, linux-i2c, openbmc, linux-arm-kernel, linux-aspeed, linux-kernel, Lixue Liang On Fri, 28 Jul 2023 at 12:40, Lixue Liang <lianglixuehao@126.com> wrote: > > From: Lixue Liang <lianglixue@greatwall.com.cn> > > After waiting for the transmission timeout, the I2C controller will > continue to transmit data when the bus is idle. Clearing bus->msg will > avoid kernel panic when accessing the freed msg->buf in > aspeed_i2c_master_irq. > > Signed-off-by: Lixue Liang <lianglixue@greatwall.com.cn> > --- > drivers/i2c/busses/i2c-aspeed.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index 2e5acfeb76c8..c83057497e26 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -713,6 +713,8 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, > spin_lock_irqsave(&bus->lock, flags); > if (bus->master_state == ASPEED_I2C_MASTER_PENDING) > bus->master_state = ASPEED_I2C_MASTER_INACTIVE; > + > + bus->msgs = NULL; Eddie, is this the same issue you were debugging? > spin_unlock_irqrestore(&bus->lock, flags); > > return -ETIMEDOUT; > -- > 2.27.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <CAARXrtmZbu3aabYJkEc25rHymRHDX4=zNdecHAs3LnQ259RkPg@mail.gmail.com>]
* Re: [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers. [not found] ` <CAARXrtmZbu3aabYJkEc25rHymRHDX4=zNdecHAs3LnQ259RkPg@mail.gmail.com> @ 2023-08-02 13:41 ` Eddie James 0 siblings, 0 replies; 3+ messages in thread From: Eddie James @ 2023-08-02 13:41 UTC (permalink / raw) To: Lei YU, Joel Stanley Cc: Lixue Liang, Lixue Liang, linux-aspeed, OpenBMC Maillist, Linux Kernel Mailing List, brendan.higgins, linux-i2c, p.zabel, linux-arm-kernel On 7/31/23 01:10, Lei YU wrote: > There is a same fix in > https: //lore. kernel. org/openbmc/374237cb-1cda-df12-eb9f-7422cab51fc4@ linux. alibaba. com/ > On Mon, Jul 31, 2023 at 12: 21 PM Joel Stanley <joel@ jms. id. au> > wrote: On Fri, 28 Jul 2023 at 12: 40, Lixue Liang > <lianglixuehao@ 126. com> > ZjQcmQRYFpfptBannerStart > This Message Is From an Untrusted Sender > You have not previously corresponded with this sender. > Report Suspicious > <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/PjiDSg!12-vrJBTB7HSMYjxkCEvpHwVyelw0CenAD3RKRjmVVfRig6DzCgRBaxHaeYsJsATzFgNYSRGXy6rQNXpmK9YdWQxScm-2h9p_bilDuLeU1r8NS5OEkCngl01P94y$> > > ZjQcmQRYFpfptBannerEnd > There is a same fix in > https://lore.kernel.org/openbmc/374237cb-1cda-df12-eb9f-7422cab51fc4@linux.alibaba.com/ > > On Mon, Jul 31, 2023 at 12:21 PM Joel Stanley <joel@jms.id.au> wrote: > > On Fri, 28 Jul 2023 at 12:40, Lixue Liang <lianglixuehao@126.com> > wrote: > > > > From: Lixue Liang <lianglixue@greatwall.com.cn> > > > > After waiting for the transmission timeout, the I2C controller will > > continue to transmit data when the bus is idle. Clearing > bus->msg will > > avoid kernel panic when accessing the freed msg->buf in > > aspeed_i2c_master_irq. > > > > Signed-off-by: Lixue Liang <lianglixue@greatwall.com.cn> > > --- > > drivers/i2c/busses/i2c-aspeed.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/i2c/busses/i2c-aspeed.c > b/drivers/i2c/busses/i2c-aspeed.c > > index 2e5acfeb76c8..c83057497e26 100644 > > --- a/drivers/i2c/busses/i2c-aspeed.c > > +++ b/drivers/i2c/busses/i2c-aspeed.c > > @@ -713,6 +713,8 @@ static int aspeed_i2c_master_xfer(struct > i2c_adapter *adap, > > spin_lock_irqsave(&bus->lock, flags); > > if (bus->master_state == ASPEED_I2C_MASTER_PENDING) > > bus->master_state = > ASPEED_I2C_MASTER_INACTIVE; > > + > > + bus->msgs = NULL; > > Eddie, is this the same issue you were debugging? > Yes, it is, and the same fix I settled on. > > > spin_unlock_irqrestore(&bus->lock, flags); > > > > return -ETIMEDOUT; > > -- > > 2.27.0 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers. [not found] <20230728122416.17782-1-lianglixuehao@126.com> 2023-07-31 4:21 ` [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers Joel Stanley @ 2023-08-05 10:10 ` Andi Shyti 1 sibling, 0 replies; 3+ messages in thread From: Andi Shyti @ 2023-08-05 10:10 UTC (permalink / raw) To: Lixue Liang Cc: brendan.higgins, benh, joel, Lixue Liang, linux-aspeed, openbmc, linux-kernel, linux-i2c, p.zabel, linux-arm-kernel Hi Lixue, On Fri, Jul 28, 2023 at 12:24:16PM +0000, Lixue Liang wrote: > From: Lixue Liang <lianglixue@greatwall.com.cn> > > After waiting for the transmission timeout, the I2C controller will > continue to transmit data when the bus is idle. Clearing bus->msg will > avoid kernel panic when accessing the freed msg->buf in > aspeed_i2c_master_irq. actually in aspeed_i2c_master_irq() you are already checking for !bus->msgs. What kind of panic are you referring to? Andi > Signed-off-by: Lixue Liang <lianglixue@greatwall.com.cn> > --- > drivers/i2c/busses/i2c-aspeed.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c > index 2e5acfeb76c8..c83057497e26 100644 > --- a/drivers/i2c/busses/i2c-aspeed.c > +++ b/drivers/i2c/busses/i2c-aspeed.c > @@ -713,6 +713,8 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, > spin_lock_irqsave(&bus->lock, flags); > if (bus->master_state == ASPEED_I2C_MASTER_PENDING) > bus->master_state = ASPEED_I2C_MASTER_INACTIVE; > + > + bus->msgs = NULL; > spin_unlock_irqrestore(&bus->lock, flags); > > return -ETIMEDOUT; > -- > 2.27.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-08-05 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230728122416.17782-1-lianglixuehao@126.com>
2023-07-31 4:21 ` [PATCH] i2c: aspeed: Avoid accessing freed buffers during i2c transfers Joel Stanley
[not found] ` <CAARXrtmZbu3aabYJkEc25rHymRHDX4=zNdecHAs3LnQ259RkPg@mail.gmail.com>
2023-08-02 13:41 ` Eddie James
2023-08-05 10:10 ` Andi Shyti
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox