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 ECEE0299A84; Mon, 12 May 2025 18:09:10 +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=1747073351; cv=none; b=stM5bvCbiT6Dh0bsmu+sSIAuTOjNgKYcitYvgBZHyVTzpD2BYix33AeIAeJ+d7+BA+FDqqgGWWLxwPkFcSVUUSSG4XiVdc5qxORAGe7f8kLwy4CPgxgFE8E0JDTrQ5/YHi92YuHp7m7rEVrjG141C8nRUPnKx5LsTgrUF+sinWU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747073351; c=relaxed/simple; bh=0EBzElVCiXS+y6AK2VjwUPTKifwhoAiMFKeep75jzKc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SQJ5inz3sw44I301LWfXICtcprb8ageJ18BFKai3+bgDGJG6/JO0FbYp0nX9GnAGDgVxQjmr59wXJOyqg/2pEhh9U8hl30rSL4djTCGw7v010L/Sc1usrZEOEiutboZfiyNDWAx60nMnblh+fbE+pQP1pXlgnlpD0oXQiBw1WC0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u0EXS9vd; 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="u0EXS9vd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E10ADC4CEFB; Mon, 12 May 2025 18:09:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747073350; bh=0EBzElVCiXS+y6AK2VjwUPTKifwhoAiMFKeep75jzKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0EXS9vdNSIKfnfXEZhKtaiIBoMbZ0oxzz13u3KQijvyVGtbWTowJfawExr+uEcvQ qhuWuYM7dogapb1Qp2cEpQCD2qdoFLqZoBzYaaqbMzgVr3XbE6mbRi3RTIB3cvJOpm PDvC0rFWcCyo9aYlYDHTSezznOxKt+h1x5TcltFo= 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 6.6 046/113] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo Date: Mon, 12 May 2025 19:45:35 +0200 Message-ID: <20250512172029.543296847@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512172027.691520737@linuxfoundation.org> References: <20250512172027.691520737@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 @@ -604,6 +604,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,