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 8C6151519B8; Mon, 12 May 2025 18:01:28 +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=1747072888; cv=none; b=B+hSHzfNfD8J31vkx1ZQlZ0GzexWDSXsEe7LeBZ8lUAbT45NO7J+is1QoSlYR8Gm4+zj92tylEKnv2x3q3Zf7cK9nF9veVflholowERe/vJm/EKLN3qvX/0RsjrKUNTxDAz+NIq4f/6N7LZ4sh3C46r7M5m6xPjWqb2ck6b9KkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747072888; c=relaxed/simple; bh=GhuQwn8sCGW2M6xFU04dAX0qi0QlS43NsJ8Oa8GbUgM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T1S3Ovq/Dd/8fawffqVrdwmD9NM3u94j3aYi7q8HAgdGNnr7FgWMvDP5VUNUvud/5t7zfSahaqOdN2FqaiQrUAR/z3MV5kI4USMhByyr1Vo0duwwhxb4mBpGPyh6mWviH/BZ0Jt9Pw2CvoXOgfSGHfbxaI6CWXIxEgE/cg7dqH0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QZouuHZ/; 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="QZouuHZ/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B927C4CEE7; Mon, 12 May 2025 18:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747072888; bh=GhuQwn8sCGW2M6xFU04dAX0qi0QlS43NsJ8Oa8GbUgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZouuHZ/6iZ/0zEpXe1k6+rMfi0we82AREdma45hlpAyKQo4EqRV2CJnDwZDmatlg DO8Hb4br/VRx4wTjoLORZMS6Cs6l3mnMQBaYATqYnpCuvWS6QeRYBSj4gE51eqzmRG F7oEzHah+jo8uyAaO+vz8Q9rGzfbzJrleA0EygOQ= 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.12 087/184] iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo Date: Mon, 12 May 2025 19:44:48 +0200 Message-ID: <20250512172045.364734153@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250512172041.624042835@linuxfoundation.org> References: <20250512172041.624042835@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.12-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 @@ -626,6 +626,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,