From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE26622331E; Mon, 2 Jun 2025 14:29:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874594; cv=none; b=OXPaAPo0zqfEOOum5vijc2Q6o+bNr04VQ9H/EIhsjYJIxE3L8Fs7H0719vBBVTwa7EJU3k8DovoLH6KbOcpVsxPhR5ZYAyS3gXgYedoU9W7DF10L9s7ObN0+8IqEhgkUCvj1pyGY40aAiqt7NIB6cAxTPxy91AF6rMBDtEPBuy8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748874594; c=relaxed/simple; bh=lxfkhneQhyHapnaZZXo6pcFYwpOs5idvE0mrJYCI1ts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tz/7xWltQ1p1/s72Y/5kYOSgYab2YC4qRfaMxY401j0W+oT2wJ5B1OjDoHDiZcT6g/G5NBZHW5U+MUR6sYzrJyNhMsa7qWmXY4Mi2ZwSv1pN9UXwbmwy4m4ENhSqhv/CS2ok/JVPZyNuxMGbPVzKWj5bz94UgvAx9SKtopLaf1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YegsBQNk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="YegsBQNk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E2CEC4CEEB; Mon, 2 Jun 2025 14:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748874593; bh=lxfkhneQhyHapnaZZXo6pcFYwpOs5idvE0mrJYCI1ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YegsBQNkptY5HkHVLW0zoBIc/mmNOv+N9UsD0qjhdE/yL+An2jvOBt5HOCXZ5nO/K hMh1tCQAq8cytexFVa/qZaQx5QYwomkULhitWXPVCL/tYdM8i400uoXkLXOqmkvUqN sK7owWQ9LRrOhz049ePYcRNHd25AWwe6DxwO7LB0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Silvano Seva , Lorenzo Bianconi , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.4 044/204] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo Date: Mon, 2 Jun 2025 15:46:17 +0200 Message-ID: <20250602134257.411310522@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134255.449974357@linuxfoundation.org> References: <20250602134255.449974357@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Silvano Seva commit 8114ef86e2058e2554111b793596f17bee23fa15 upstream. Prevent st_lsm6dsx_read_tagged_fifo from falling in an infinite loop in case pattern_len is equal to zero and the device FIFO is not empty. Fixes: 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") Signed-off-by: Silvano Seva Acked-by: Lorenzo Bianconi Link: https://patch.msgid.link/20250311085030.3593-4-s.seva@4sigma.it Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c @@ -541,6 +541,9 @@ int st_lsm6dsx_read_tagged_fifo(struct s if (!fifo_len) return 0; + if (!pattern_len) + pattern_len = ST_LSM6DSX_TAGGED_SAMPLE_SIZE; + for (read_len = 0; read_len < fifo_len; read_len += pattern_len) { err = st_lsm6dsx_read_block(hw, ST_LSM6DSX_REG_FIFO_OUT_TAG_ADDR,