From patchwork Thu Nov 17 09:24:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WXVuZmVpIERvbmcgKOiRo+S6kemjnik=?= X-Patchwork-Id: 21517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp299601wrr; Thu, 17 Nov 2022 01:27:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf6BGHi8IEIDFAIM5Z6hdbiaKiy6tih0JInMNtf/Ku91Rz+PHli4wGBWq5t9nnv8x+BBzSGv X-Received: by 2002:a05:6a02:108:b0:46b:3acb:77ab with SMTP id bg8-20020a056a02010800b0046b3acb77abmr1284984pgb.359.1668677278864; Thu, 17 Nov 2022 01:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668677278; cv=none; d=google.com; s=arc-20160816; b=pbbaqu+VI9aUhIzkTjjHjp4n/V1bWf/y4JtacxIp9eSou82veevy5rC8NKicHGZEqI RjMEdNjPRHN+3ZqFKJgQAWvlSTaZEzu8BHAfp4DXK8eWrk1twyIR0XG35RlaYBT1u2ze qYfDTg+lnJpdUoKmt0EJTgPOGdBqg73fBwtzuw6LAHalO/lSYhDhReMO49W5WPB++amW huD/KwEAXwNS92M1rbcPK6QcEV6QzJgdOX6rm251wFdt4xEvBTf1S84C1IDJp8P1/ZCy IF2L/w5oJrYbMvwTVGeGyf7KFxx9krNV8qyBGSEoHTd4259R9t5m/dMlGeiVTeRoeqW/ ARAg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zviENZfXwyOfFZjYFG/07wjjoPE34cnyXb34jHJ5SG8=; b=KboprE9sccLTpFDdqj0URVjmhvHucVFR8M576kz9k9VH+AnnbIJCdKbKoV71GmbXNk POYl8J9onjQeo9RZxHvPAXr6PNjGEF/pLRjxqLXLlOaLV1fuiRlaSKZ13FhPX5pJv9o/ L8QNjij+5hbvJiNclN0j21lPzhmr3WfgrShfxVubhrWhWc7bW/8aQWce/2EhXPjYdKBN drsGduIV8mGP9WJFIafn7+c9qTbO6F1SwYuldqIWNjwi448G+Vfg2iaogpM9L2mjHrH2 rHKxUhkxDKgfZW1WoKLRxYluS/hYn/U/6ZvpVK/ZtLtYB89xCs03JhYA7hAW/owFGVIf E/7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=IM1abASH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a170902a38700b001842f465c10si481316pla.438.2022.11.17.01.27.46; Thu, 17 Nov 2022 01:27:58 -0800 (PST) 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=@mediatek.com header.s=dk header.b=IM1abASH; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234312AbiKQJZV (ORCPT + 99 others); Thu, 17 Nov 2022 04:25:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234248AbiKQJZI (ORCPT ); Thu, 17 Nov 2022 04:25:08 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41D6A5FC7; Thu, 17 Nov 2022 01:25:03 -0800 (PST) X-UUID: 0251dd356a174eb0b03b3eaa06a97557-20221117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=zviENZfXwyOfFZjYFG/07wjjoPE34cnyXb34jHJ5SG8=; b=IM1abASHy9/G4x2uRgj7wjpCEKvC1F08marpFfvS7tfLVl+2TEaW/GYeWfZvhigpPxIGChVXRMMRWXY2skFTI9QG004UCrBr/pgg2c21DeCfUFVW+T8+It2qmO5hcS7zB76RI7MX717ddAgQyjCmGvcvltvEWbvRuQ6+4Lg+dMs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.13,REQID:0933916a-1895-431e-a0a4-e464b4119c2e,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:d12e911,CLOUDID:6b340c2f-2938-482e-aafd-98d66723b8a9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 0251dd356a174eb0b03b3eaa06a97557-20221117 Received: from mtkmbs10n2.mediatek.inc [(172.21.101.183)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1259357121; Thu, 17 Nov 2022 17:24:59 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 17 Nov 2022 17:24:57 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 17 Nov 2022 17:24:56 +0800 From: Yunfei Dong To: Yunfei Dong , Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , Tiffany Lin CC: Mauro Carvalho Chehab , Matthias Brugger , George Sun , Xiaoyong Lu , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v2,2/5] media: mediatek: vcodec: Can't set dst buffer to done when lat decode error Date: Thu, 17 Nov 2022 17:24:50 +0800 Message-ID: <20221117092453.31366-3-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221117092453.31366-1-yunfei.dong@mediatek.com> References: <20221117092453.31366-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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?1749734946394005233?= X-GMAIL-MSGID: =?utf-8?q?1749734946394005233?= Core thread will call v4l2_m2m_buf_done to set dst buffer done for lat architecture. If lat call v4l2_m2m_buf_done_and_job_finish to free dst buffer when lat decode error, core thread will access kernel NULL pointer dereference, then crash. Signed-off-by: Yunfei Dong --- .../media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c index e86809052a9f..ffbcee04dc26 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c @@ -253,7 +253,7 @@ static void mtk_vdec_worker(struct work_struct *work) state = ret ? VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE; if (!IS_VDEC_LAT_ARCH(dev->vdec_pdata->hw_arch) || - ctx->current_codec == V4L2_PIX_FMT_VP8_FRAME || ret) { + ctx->current_codec == V4L2_PIX_FMT_VP8_FRAME) { v4l2_m2m_buf_done_and_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx, state); if (src_buf_req) v4l2_ctrl_request_complete(src_buf_req, &ctx->ctrl_hdl);