From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 9F1E138837D; Sat, 12 Sep 2026 19:42:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242154; cv=none; b=XCxoWg91hQWJzrMjCdO38XRnmlOgxbz+1tgP0i6U8LALhydsrXgwCfHFhS7oVvY3k9CP15dRBABqzEP4hu4JMqTf/MZoMVRMbZDdsrGgaqev+lf4DLdsIGkasBVQQtNCdUptJ60t5acPynXTW773aYYpsR2CqiUgKTG2J1Jj/OU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242154; c=relaxed/simple; bh=e7kZJYnksE2jzrG+aPL9A/77kE6DF3zDPTLGFzu/mG8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VjVi33b1+bF+oKKKQjccaTn/sC8dYrRB4SOL87eM6kk+/061GTWao93ir3QQ3KU/OiZ+Xcv/oF6U0P2VfAOU73pwOCrVP5GR1QdCjAdK+uQ2dzmqEyOSprOAP+cUURJAjcvMZxHYMJTUOM+xSjBDCf+uPs3sxCwC2U21YD3IP3w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y6CyKsPx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="y6CyKsPx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0136F1F00893; Sat, 12 Sep 2026 19:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242152; bh=HsobIiLT7X369qHzONnKDq39m0DeN+BG19M0/LvJY7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=y6CyKsPxT1USsDTTiByBzDjv+2gTqCOMm7jYXNhAUH86stcznGGkQPFlZQp1MYfp/ 2szSjHKUZg1FEblslVxjJdhHKM/Jl7KwsEsf3lf8qx8HK4Ewdzi/MAR5dbrk7sDSyi JXnONgV7Ha4J/5qPnP6kmPpEzZxnt1sTzwIRryaA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mohammed EL Kadiri , Dmitry Baryshkov , Bryan ODonoghue Subject: [PATCH 5.10 287/798] media: venus: fix payload size returned by parse_caps() and parse_alloc_mode() Date: Sat, 12 Sep 2026 08:58:35 +0200 Message-ID: <20260912065523.741434930@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mohammed EL Kadiri commit a51cea23e409278f6e2ea072280aba93cc1dd75e upstream. parse_caps() and parse_alloc_mode() return only the size of their fixed header fields, excluding the flexible array payload. hfi_parser() uses this return value to advance through the firmware response buffer, so underreporting causes parser desynchronization. Return the full consumed size (header + entries), matching the correct pattern used by parse_profile_level(). Fixes: 9edaaa8e3e15 ("media: venus: hfi_parser: refactor hfi packet parsing logic") Cc: stable@vger.kernel.org Signed-off-by: Mohammed EL Kadiri Reviewed-by: Dmitry Baryshkov Signed-off-by: Bryan O'Donoghue Signed-off-by: Greg Kroah-Hartman --- drivers/media/platform/qcom/venus/hfi_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -85,7 +85,7 @@ parse_alloc_mode(struct venus_core *core type++; } - return sizeof(*mode); + return mode->num_entries * sizeof(u32) + sizeof(*mode); } static void fill_profile_level(struct hfi_plat_caps *cap, const void *data, @@ -146,7 +146,7 @@ parse_caps(struct venus_core *core, u32 for_each_codec(core->caps, ARRAY_SIZE(core->caps), codecs, domain, fill_caps, caps_arr, num_caps); - return sizeof(*caps); + return num_caps * sizeof(*cap) + sizeof(u32); } static void fill_raw_fmts(struct hfi_plat_caps *cap, const void *fmts,