Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1781132rwb; Thu, 17 Nov 2022 01:44:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6n6vl3qBV6Is57FfQSyCDMop6lLf721CxwR76CbcXXXJq3g/3X2Q6L5H3TBu1UqidYDU1Z X-Received: by 2002:a50:ed15:0:b0:458:9925:fb74 with SMTP id j21-20020a50ed15000000b004589925fb74mr1458737eds.330.1668678297240; Thu, 17 Nov 2022 01:44:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668678297; cv=none; d=google.com; s=arc-20160816; b=PGPSuwbIAgIu8cVVN/KAv98lSuOG0ZoII04AYlbqfliDYd7ipj67AiZLYNOsEZVRqX BsruKP7MJbYNp6Eo9XBxA8JfYsMoJe4m/4OXNGTwWfZDo8C/0TSqatq77H2Zhd0P4jDT JEGFynCLLYX7CbhtBZw+grl8/oU9IdomQVG8lU4d0tQAlKUtgjxdQ1chm0v/Pi3PyXNV nV6vfaob7Qzai7QSL4r3KWwYYThZQKjOzOw67liCyr8TsaWuOoDk2kOn+k+5MKFjN/H7 YjnCoM111jC/YKqbCuJhtl6CAv6TFTHwxm/faoeRcibhDCuz9n8iV41hHFpwQh/oS+pS RN+g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz12-20020a17090775ec00b0078d8bd255d4si157219ejc.949.2022.11.17.01.44.36; Thu, 17 Nov 2022 01:44:57 -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 + 91 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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 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); -- 2.18.0