Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2403083rwi; Fri, 28 Oct 2022 06:45:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64qdKe5yEXV3miZTpBWXR7qFcYdeM9r9CQ9dwhXfvBmNK27qzY5Z8UqLIF/OkC4wQZWDlD X-Received: by 2002:a50:cc07:0:b0:453:4427:a918 with SMTP id m7-20020a50cc07000000b004534427a918mr51128546edi.121.1666964747576; Fri, 28 Oct 2022 06:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666964747; cv=none; d=google.com; s=arc-20160816; b=FRiHaGt9hO4oaB5tD6gCPjOc9yDARayQfmWZ0FHhkgMTbJ/l3VL3lFGbdOm2qElcym nfWM0jSfcr8HlXnrv3VJUsgUyqB0ntFCoSJd1XpCVoTiZeY/3oCvgiQquYKYhcDbS5hM tiWGO9ml1l+dX9zAm4zvbqmP1ug9wBTP92YDcNoIQCwLZIU+8r6HcQbyH+5MNt0mXB51 OaurIjXSOlNvf3PTRCdMyeGp6tOYEeR7Pv5sVaLNJQ9m56D6ANs7B0oOgkIpLcIH8LwP s6FAev2JhI7LL8N1uVIMSRrv0ePiMc1YE66q6pANeSaN+6u/NmToJL4xNBZy/OM90LsO dGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PdukXL+14+SCNZvplferwaLudZcQBMaEPikpoQpVCHg=; b=KH5tf7+4Gn2d3roVPCyNe1ArQhXIErs8vOQYJesJjrMALpzc8Ff5QydiTlVhkQQS+x Dig0mr1wm7ffOES6PRZEK2QuAt1pEZ1dty0abtmlzQBrQl9kHpt59GlHtadm1uMAdgJi 0XEpdBp3FKvmKqkzCyPpe0NteHKZ+fjyD1m06cnZuPx/coyVWLsRzJIyl4fyWDFGACkq ilRiAglQY1MWsr4oMZPAaCcvsd/ERJoPKEqd1fWYYBlJ4MKLSXIfmwaWNmZwhOmtQHsH OhFNusMh0UV4bJhNXFHjEIA5ibLz5puL5FFcDW0laVY+AXn8zoieajD5YVkA5YL0gbl7 Sbng== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js2-20020a17090797c200b0073dc32ccd9fsi5017662ejc.104.2022.10.28.06.45.21; Fri, 28 Oct 2022 06:45:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbiJ1M6d (ORCPT + 99 others); Fri, 28 Oct 2022 08:58:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiJ1M6b (ORCPT ); Fri, 28 Oct 2022 08:58:31 -0400 Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FF3F1CC3C1; Fri, 28 Oct 2022 05:58:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 6266A186458D; Fri, 28 Oct 2022 15:58:24 +0300 (MSK) Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7BSvSK3WxBlH; Fri, 28 Oct 2022 15:58:24 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id ED4DA186458E; Fri, 28 Oct 2022 15:58:23 +0300 (MSK) X-Virus-Scanned: amavisd-new at astralinux.ru Received: from mail.astralinux.ru ([127.0.0.1]) by localhost (rbta-msk-vsrv-mail01.astralinux.ru [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ud5wkNZ1Usua; Fri, 28 Oct 2022 15:58:23 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.20]) by mail.astralinux.ru (Postfix) with ESMTPSA id 27F931863FEA; Fri, 28 Oct 2022 15:58:23 +0300 (MSK) From: Anastasia Belova To: Mauro Carvalho Chehab , Matthias Brugger Cc: Anastasia Belova , Tiffany Lin , Andrew-CT Chen , Yunfei Dong , AngeloGioacchino Del Regno , Hans Verkuil , Nicolas Dufresne , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, lvc-project@linuxtesting.org Subject: [PATCH] vcodec: mediatek: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs Date: Fri, 28 Oct 2022 15:58:11 +0300 Message-Id: <20221028125811.11340-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 If vsi->frm_bufs[vsi->new_fb_idx].buf.fb =3D=3D NULL while cleaning fb_free_list NULL-pointer is dereferenced. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: f77e89854b3e ("[media] vcodec: mediatek: Add Mediatek VP9 Video De= coder Driver") Signed-off-by: Anastasia Belova --- drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c b/= drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c index 70b8383f7c8e..b0679aaf6192 100644 --- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c @@ -512,7 +512,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *i= nst) * clean fb_free_list */ if (vsi->frm_bufs[vsi->new_fb_idx].ref_cnt =3D=3D 0) { - if (!vp9_is_sf_ref_fb( + if (vsi->frm_bufs[vsi->new_fb_idx].buf.fb !=3D NULL && !vp9_is_sf_ref_= fb( inst, vsi->frm_bufs[vsi->new_fb_idx].buf.fb)) { struct vdec_fb *fb; =20 --=20 2.30.2