Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp209429rwb; Thu, 27 Jul 2023 11:28:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlETVTSekN2fCYU5clGNS3N+Jihwd8pzSKcr/me3GlFtilqvlVmiQ1Vz4BqTgvR5t/4wYZeF X-Received: by 2002:a17:902:d507:b0:1b6:c229:c350 with SMTP id b7-20020a170902d50700b001b6c229c350mr178375plg.18.1690482531883; Thu, 27 Jul 2023 11:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690482531; cv=none; d=google.com; s=arc-20160816; b=iHhNeCEvyWwoYkVTVQk+l+fxyTAPrVWjOOWa8LBD9HopNoKrk78ObZgh2apje+hYGN +ba0Y0oVZAqZOCvg2hizI8+HdRfIYaEZBqGF9gGerkAm6CjhC505Hz8WJYVgAhFGiKNT PxDtkFVoqIUqu5wpsXxcuNNU4FMq5uqd6vuQTzA8iWvvo0a0TPAQGpDA8ITPHNDXIcDF UdDyaf7+q8gV/vmraIG9dVN9X74T9aEl0GUmXZVEw9NOC4M8jrSWhBitVokqB13uZgVz /7iR6bSe7bOUvLvBA/cQ+fyKQ/HVcYJD70lyGuPFQkJC8rgZkSGRRXTQQRpekriikTiU 6K9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=SBbf2syuRIw8JyAjPtp/cVqlfqIQVNdrVeEynwYMxXg=; fh=o+a/HdGUJRAtQZLuq31MmS7qWd7z+zar0tX6jadH2B8=; b=r+AJnQa5ZCdwMoD/DmrXNsQMLrX+q7phF2HzAKSVDHKyG/pIqiUOTZBrPralfYazx3 YEtQcNpUimC49q4plnphEP39EAGf+gCD/JNjx3JD4SxXbVWAK/G9kqJL4ey4hTSvPjDh IdiN8HMcQosxzw2ryXjmwLIRtNkUXb0+yAH5t/x6rcn1dbr5VqVk6gM4IHaCDKEQCnq3 t7FMgdfuiBSFSIhrkz+lgxOrirmOucu0ylOHkJJNdk9N4HcY6xKBRtpIzfBKFuGGdRVH qRmYUZ3BhsV302MTaseqBpGYXaEeF55etp8RKffsMufirecwjhggZSmyAcJIz0wsimdK QiCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sTNcib6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x12-20020a170902ec8c00b001bbb39ffe06si1723715plg.69.2023.07.27.11.28.38; Thu, 27 Jul 2023 11:28:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sTNcib6+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230349AbjG0RLb (ORCPT + 99 others); Thu, 27 Jul 2023 13:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbjG0RL1 (ORCPT ); Thu, 27 Jul 2023 13:11:27 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D4730ED for ; Thu, 27 Jul 2023 10:11:24 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b95d5ee18dso18475261fa.1 for ; Thu, 27 Jul 2023 10:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690477882; x=1691082682; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SBbf2syuRIw8JyAjPtp/cVqlfqIQVNdrVeEynwYMxXg=; b=sTNcib6+VM1f/L7et/IKdD6pyGmOLtnuUo0j06e5m3EzssAyOguH5QGtgMezutJaM/ Mf2V4e3B8roPoGcQq1jvR4Vl38flaBMGgGnI5xHVILM1qUFXQaCbfwCkdRUX+PXdjZCi eEXaE2fVUbuozsUB2/ARGAoklcx02gcturkTu2fbTK2eHNHP2+CEWNwYECzK3y6UcSL3 Ew6ByP0mplHDLnmELii/BTIMPEo6EWVmMWiRWzq9aW4Cx6HQPaf9KUt9Ek/nmWGspapS ijbCJFz40EZecpN7oV6Qpz1Q5NaWG5O6Dkff0oUvMyZzXVS81DzSXolvbNOxwstaxOa9 GWMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690477882; x=1691082682; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SBbf2syuRIw8JyAjPtp/cVqlfqIQVNdrVeEynwYMxXg=; b=YyBCDjfE6ax8nvLbFYhnCJ4xqImHBKK0dnlcHML2WaKu+5SW31PTiRl3qBaO/bjC2z kimsXEOUKJjVv0KoqJjAWKaTTWJhsgF9IUIwfL1+e0BINWR3XP9oQVD3VrDUkK09nbli 2lMNeu/CZ77Yp5Y8UbHsKijBLpG4jO8Ih8rchHBZp9qNHC2HzVB+g/26p9bYyjrGXrQE laWyS8wDnCYsq5asENK1LSCHrjf+kY72iMTwufTF/P8uUx1iEHMpIT6ndtuVQUITRkl+ OHTL/vfTojk1pqE4u9BectYRP/SBTZCsM0Cd9nHK6dHyYVuLT1tgzEYbRtC32e8f3xyU V8xg== X-Gm-Message-State: ABy/qLbY8Jl9zfhjzNnAcwUXinVEC32y3DNov/3im5VugGDEv4ZwNaPs IeDVaJkc6dm5pvdSBkelVKe4hg== X-Received: by 2002:a05:651c:205:b0:2b7:a64:6c3c with SMTP id y5-20020a05651c020500b002b70a646c3cmr2210462ljn.37.1690477882687; Thu, 27 Jul 2023 10:11:22 -0700 (PDT) Received: from [192.168.1.101] (abxi99.neoplus.adsl.tpnet.pl. [83.9.2.99]) by smtp.gmail.com with ESMTPSA id y4-20020a2eb004000000b002b944151da5sm441863ljk.81.2023.07.27.10.11.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jul 2023 10:11:22 -0700 (PDT) Message-ID: Date: Thu, 27 Jul 2023 19:11:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/4] venus: hfi_parser: Add check to keep the number of codecs within range Content-Language: en-US To: Vikash Garodia , stanimir.k.varbanov@gmail.com, bryan.odonoghue@linaro.org, agross@kernel.org, andersson@kernel.org, mchehab@kernel.org, hans.verkuil@cisco.com, tfiga@chromium.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <1690432469-14803-1-git-send-email-quic_vgarodia@quicinc.com> <1690432469-14803-5-git-send-email-quic_vgarodia@quicinc.com> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqAL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ezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <1690432469-14803-5-git-send-email-quic_vgarodia@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27.07.2023 06:34, Vikash Garodia wrote: > Supported codec bitmask is populated from the payload from venus firmware. > There is a possible case when all the bits in the codec bitmask is set. In > such case, core cap for decoder is filled and MAX_CODEC_NUM is utilized. > Now while filling the caps for encoder, it can lead to access the caps > array beyong 32 index. Hence leading to OOB write. > The fix counts the supported encoder and decoder. If the count is more than > max, then it skips accessing the caps. > > Cc: stable@vger.kernel.org > Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser") > Signed-off-by: Vikash Garodia > --- > drivers/media/platform/qcom/venus/hfi_parser.c | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c > index ec73cac..651e215 100644 > --- a/drivers/media/platform/qcom/venus/hfi_parser.c > +++ b/drivers/media/platform/qcom/venus/hfi_parser.c > @@ -14,11 +14,26 @@ > typedef void (*func)(struct hfi_plat_caps *cap, const void *data, > unsigned int size); > > +static int count_setbits(u32 input) hweight_long()? Konrad