From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E21873ACEF4 for ; Thu, 22 Jan 2026 12:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769084340; cv=none; b=iSutG8bj+P7/KaROgugK1b5V93hoIQuLMdS57H9ZyF6hW58ytbU16DSKM/ymEeE50Ej4CmgdKlDel56Z9tnsG00A5tPG6IGTO0g4kbbXDkMB5pAHjUTeJyCTCxPf4b59mWVkXl6vNf/HmqfF6vtemDH6W83lVEZgM4QjfF8yGtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769084340; c=relaxed/simple; bh=s0PP6POZG+0DDhlnkBd6RLq6XlMNNCrkEEqlrLC8oio=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UW6AX1TRSof+eMfj+Hq3UmAWKX8dmJY8+CfK+F08KRc+ydlSeoSzUG8IVRBGZZbISN2dAzQDkEW872KbIQtiI3396XNvj9RsQaT2LAK6i2UmrOS4xaYXTIc+xgMacIoC0zjoz2o1ee8hvaCxWqZWVFyciAl3lxLVzf7PGFaCZ1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L44yAuw9; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L44yAuw9" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47fedb7c68dso9398435e9.2 for ; Thu, 22 Jan 2026 04:18:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769084336; x=1769689136; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Aw8PwRqcSFnjHYu9kruFq08beZFwPpI2ZTR02sRsPTY=; b=L44yAuw9UXdXbQTfb37ta+820tlRHp05ren+Relt6nJvhkTrFiNWJ7PdUiOOBoX5xd gZTqA2IkC0Gp4DqycajqLcqCp3+4I+cuiiiuWyAtxKd3QxI+GHPA1nIUXoH5tzMTTVRD n342LpUbMuhkdTI2ufpW+0wHsj3E1X2xH77qW8dPXo1rd47RgDv2dhLS2wjY4U9V8tbH a749LF4Xkoi1WO7ITYTJPRlFFAC5Dd1VTzdjQUI2tP0lGSWpcvnB//aZ65mhxLafBNcQ c10aSh0EQuUFO9s44yBvyGnXAA2m0yF5gTRW1iqu/VWnVwS3ONOLMaXqIhnnZk3e4VZA OnSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769084336; x=1769689136; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Aw8PwRqcSFnjHYu9kruFq08beZFwPpI2ZTR02sRsPTY=; b=HCGYRoMbp3KU2SHOBDfNfXqxQpFySrFj3JO9AWWrGodZ59Yb/NqYg9vel6Ea7SoaB/ gV1Bu/ONHjYSbGWVuw26h3EAIMRD9maLbzUhRA0rVGZVnCTKtJp06b53wFz13tJmyoFJ zSt5ztDN6Ephm2RMHd/oTojkEgIj7dWgRtG9aB3nHPmFsHjojg6aMIAgzJZ+ZVEzu11D s9K1a9JFdIkWvkF2zcDEAy48PQJOKRJNueNOk5nQqZWoUd3pyF9UA2veESNEiJ1KxwC5 LdqjXH6xm19gdLjbUlRmcPFv+f1oNbCAc0xiytzHpLO0/oqJ9awLyqJJ81/i1xeE0avV 4tCw== X-Forwarded-Encrypted: i=1; AJvYcCXo4xE1Abu6H9rDwgEejF7dKR16X9d+M58N1vfTAtL0tMtBF0xLUjZsux6Gq4GkYYCFlaEDn52OtxNtn88=@vger.kernel.org X-Gm-Message-State: AOJu0YyzssxGbS26Y8SK8E5uiDimq64mtQNuRG4SUsW2pSTOKYC0tK8y NE8ovCz1+XK7xQmuapE+T1PA+20huWaGxMY96fUfQg3wY25ykhNQNmyBW7RRFQ== X-Gm-Gg: AZuq6aJnM0CsxTuO/FL+22N1BLUpsSFJFK/fvCHuia3P2RuLd/hw98tNQBc7EJBlzkm W+NaeP+3jUwAYwAW9QNbAz2IInip2kyzCGYaYuee+9kuLRw0ZZ6DPa/wX31K556pna0aewt7wuW 6s3VvjrbOB4n0ELCMTQ032pLAg0ezf5jsp8e/L3aqSc/gE67QvQfHNRY55553RsHWc2cQQWPvK7 BDcoHJcPcgX/ebYQ+2/Wu8NQC8F7YfLfdfQ/C+jKkFFStWmXzjGb7mqHCnIZBJ0pmVbmjo/VCkN WhNVeNx247RMUvrHXKex6WEm7R6GJIky2xaVxm91tbVBzkz47yMjFZoCngrH/BC9ss2w/HKLuBh pAKRP80vFOPWrgl/IO4dBlWJj5Rpcv+SaV14MB2EyVCxOvVyAM4ycoG0bp5fxsQ8r+LBnIOyniD J94VPBtoIGihg2fgcQ2hsZSQ== X-Received: by 2002:a05:600c:3e07:b0:480:3ad0:93bf with SMTP id 5b1f17b1804b1-4803ad094b1mr190051015e9.24.1769084335819; Thu, 22 Jan 2026 04:18:55 -0800 (PST) Received: from eichest-laptop ([77.109.188.37]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43595e0a6fasm16302233f8f.10.2026.01.22.04.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 04:18:55 -0800 (PST) Date: Thu, 22 Jan 2026 13:18:52 +0100 From: Stefan Eichenberger To: Andi Shyti Cc: LI Qingwu , o.rempel@pengutronix.de, kernel@pengutronix.de, shawnguo@kernel.org, Stefan Eichenberger , s.hauer@pengutronix.de, festevam@gmail.com, linux-i2c@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bsp-development.geo@leica-geosystems.com Subject: Re: [PATCH V3 1/2] i2c: imx: preserve error state in block data length handler Message-ID: References: <20260116111906.3413346-1-Qing-wu.Li@leica-geosystems.com.cn> <20260116111906.3413346-2-Qing-wu.Li@leica-geosystems.com.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Andi and Li, On Thu, Jan 22, 2026 at 11:48:54AM +0100, Andi Shyti wrote: > Hi Li, > > I'm adding also Stefan in the Cc list as he has authored the > lines you are changing. > > On Fri, Jan 16, 2026 at 11:19:05AM +0000, LI Qingwu wrote: > > When a block read returns an invalid length, zero or >I2C_SMBUS_BLOCK_MAX, > > the length handler sets the state to IMX_I2C_STATE_FAILED. However, > > i2c_imx_master_isr() unconditionally overwrites this with > > IMX_I2C_STATE_READ_CONTINUE, causing an endless read loop that overruns > > buffers and crashes the system. > > > > Guard the state transition to preserve error states set by the length > > handler. > > > > Signed-off-by: LI Qingwu > > I asked you to add the Fixes tag here. Perhaps you need to add: > > Fixes: 5f5c2d4579ca ("i2c: imx: prevent rescheduling in non dma mode") > Cc Stefan Eichenberger > Cc: # v6.13+ > > You can get the information above with "git blame". > > I'll wait for comments from Oleksij and/or Stefan here. > > Andi > > > --- > > drivers/i2c/busses/i2c-imx.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > > index 205cc132fdec..05ba41144648 100644 > > --- a/drivers/i2c/busses/i2c-imx.c > > +++ b/drivers/i2c/busses/i2c-imx.c > > @@ -1102,7 +1102,8 @@ static irqreturn_t i2c_imx_master_isr(struct imx_i2c_struct *i2c_imx, unsigned i > > > > case IMX_I2C_STATE_READ_BLOCK_DATA_LEN: > > i2c_imx_isr_read_block_data_len(i2c_imx); > > - i2c_imx->state = IMX_I2C_STATE_READ_CONTINUE; > > + if (i2c_imx->state == IMX_I2C_STATE_READ_BLOCK_DATA_LEN) > > + i2c_imx->state = IMX_I2C_STATE_READ_CONTINUE; > > break; > > > > case IMX_I2C_STATE_WRITE: > > -- > > 2.43.0 > > It looks good to me, thanks for the fix. I wonder if the functions in the isr should instead better return a status and based on that we decide if we have to change the state or not. Then we would have the decision to what state we swtich at one place. However, this would probably be too much rework for that fix. Therefore, if you add the fixes tag suggested by Andi: Reviewed-by: Stefan Eichenberger