From patchwork Fri Oct 28 09:25:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anastasia Belova X-Patchwork-Id: 12191 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp726503wru; Fri, 28 Oct 2022 02:48:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4DeL1nP5KIa0yp80wprsoKy8qWZvBBkYc4StMUI6674aEBqjbM90IIDnuqzRsyh1hX+NwX X-Received: by 2002:a05:6402:11d4:b0:45d:8733:7cc2 with SMTP id j20-20020a05640211d400b0045d87337cc2mr49101697edw.409.1666950497713; Fri, 28 Oct 2022 02:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666950497; cv=none; d=google.com; s=arc-20160816; b=BMz27n/BU/T2mLhHhIuDf5Z2oVle7Vh6oa3GPdKJ6EmgHG4SUUBitkeaXGQwyyFCF7 R614sAYTdYEnzzL018wNlgO4gnSd6NyHIWdPVV1v0Fhr8471ne3HbXKbxsWwgOhboyfI 4ZZtaWQq28w1tkDACva6h7JrOQMv1G/tcpZPSzxgipY1CUsBFd5qsSpxwu9QPG4sY/Gy ez9e/Z9vbDRNFiDhmzIOWO0Nth54Jy8qv1JQHCRC8fVmR3oJyWs9wGZ3u8TFhmWn/MTy Yb589shoTaQ8FRa+iqr2KAGIeBzxhD7uaIcycSd7As3aoO27HJ13883c8ZKEe67QDBt/ Dt0Q== 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=zwzLdWoWFgq62O5OUUPFj6Ag8jaRzLM+v7K+j93cq9Q=; b=knd+6Jqa0VzfeX/jJOwYSMOpssBl+CFE7kCFOkiPTF5KQ8DeGONKDBmUCyxDaPkKQI rTJJfdDiJPtbIcyNq3J+mKeSS5A/atW3mJwwqETANdPHyRsZiVYLlGkJk3Nw26f3zcv6 syokTO67fvUK0Zh+4HnvkvyfDnwjY+KF+jFvgwz7CpW85QssJQY4QJb5klpu/8G1qhOw ru5UtfHYP/Oj86gxIs3Yka0IAIppfHFIv4O0xhDxJ5jPnWcurXw5hieU7sh9FWM3Rlw3 ypSQ/PgPKebFvIg0GOa+WL1uqsNgmFQNIQZIV7oHkYtS7UcPhX7hG9CTs9h4xyTdC1N0 SWQQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp28-20020a1709071b1c00b0077077ded253si3140216ejc.924.2022.10.28.02.47.54; Fri, 28 Oct 2022 02:48:17 -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 S230292AbiJ1Jg3 (ORCPT + 99 others); Fri, 28 Oct 2022 05:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbiJ1JgG (ORCPT ); Fri, 28 Oct 2022 05:36:06 -0400 X-Greylist: delayed 597 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 28 Oct 2022 02:35:27 PDT Received: from mail.astralinux.ru (mail.astralinux.ru [217.74.38.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 394B959244; Fri, 28 Oct 2022 02:35:26 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 44B421863F30; Fri, 28 Oct 2022 12:25:26 +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 wmW6qRmkIY0a; Fri, 28 Oct 2022 12:25:26 +0300 (MSK) Received: from localhost (localhost [127.0.0.1]) by mail.astralinux.ru (Postfix) with ESMTP id 04B521863F18; Fri, 28 Oct 2022 12:25:26 +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 es316AFVOzqz; Fri, 28 Oct 2022 12:25:25 +0300 (MSK) Received: from rbta-msk-lt-106062.astralinux.ru (unknown [10.177.20.20]) by mail.astralinux.ru (Postfix) with ESMTPSA id A95B11863ED2; Fri, 28 Oct 2022 12:25:25 +0300 (MSK) From: Anastasia Belova To: Vinod Koul Cc: Anastasia Belova , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: [PATCH] vdec_vp9_if: add check for NULL for vsi->frm_bufs[vsi->new_fb_idx].buf.fb in vp9_swap_frm_bufs Date: Fri, 28 Oct 2022 12:25:16 +0300 Message-Id: <20221028092516.19070-1-abelova@astralinux.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747924284809921518?= X-GMAIL-MSGID: =?utf-8?q?1747924284809921518?= If vsi->frm_bufs[vsi->new_fb_idx].buf.fb == NULL while cleaning fb_free_list NULL-pointer is dereferenced. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Anastasia Belova --- drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c index d9880210b2ab..dea056689b48 100644 --- a/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c @@ -512,7 +512,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst) * clean fb_free_list */ if (vsi->frm_bufs[vsi->new_fb_idx].ref_cnt == 0) { - if (!vp9_is_sf_ref_fb( + if (vsi->frm_bufs[vsi->new_fb_idx].buf.fb != NULL && !vp9_is_sf_ref_fb( inst, vsi->frm_bufs[vsi->new_fb_idx].buf.fb)) { struct vdec_fb *fb;