Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp68617rdb; Tue, 31 Oct 2023 00:18:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6md7yGkZb3eMmAOIgbzRHI8VkyGsoMb3UjedBYtZsgqI3cFN0PO7QJfh9jxhgQYxIiPZZ X-Received: by 2002:a05:6a20:3d0b:b0:16b:79c2:7d6e with SMTP id y11-20020a056a203d0b00b0016b79c27d6emr11653278pzi.30.1698736686412; Tue, 31 Oct 2023 00:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698736686; cv=none; d=google.com; s=arc-20160816; b=lmEUwoWU5IiWDZtSI0ojeRHR6jYGX3YS43aiG7JIOEKWAtENbXcp8s2aubCCUuAY++ H9eXTpWoDGMcQyhpKIZLkEABDOocV5ILsGQjHpnxvtSGVx0FoiXPhbCmF+ZzwUBxp60N hi3XYF0WtYVsDv5ldm5DX+txPxP5SnnOtEYCrNri+ojig308fUF3gESI8ysem2SfR7QC hEJhkafwdczaouhPd6o0AXUtWT0VvL30gLDEDuJXGk4h9rjvGERSubuSGjPru0fISfa7 RG/DmpToq1I6eIebf677bWqIrw1pSFTbrqvpHLmlWi7q6ltNXE2dNQKWAlnAo0Nq1hda NIiw== 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:dkim-signature; bh=6VOElouc2GMG6bSXp2UcAdff2CtTi6AX9Q0p7itVxKA=; fh=BUOxERKiHMKNK1EXVoIyLQc16i4PhksEBSx6UgkZJ98=; b=QolFddT1opuUK1u9gZg5Vlg3rz+cMi79cMpNjwnpMcnCrvh+Xa2bVAnQKvtzT5P3GN 50O8iY5JJnsOLUUwctyYcqwC5gKEFVU83PKR+IrSJTUtoUYG/7rrpAn666ZJMElwh2En aTIBYPlB6QkPSbndax11FxnyjSd2wQcsu7u4UXLGJ5h/i8rD3gBbAXGxwCUv1JIVjdEO pBE33LmhLwq0Xs1Umx0UQbz/Se+edEOgv3TQmSumkIHLFSPNYNnyCnH5ErpGgwe6oxPJ wjNiotIBVVXiSLe3DcnF5UaVkKcRWUowdECUwMv6Xpd6PWqzWb9zsCRrv5AgHJ1IEcAf REwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=hNxmtqR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ch9-20020a17090af40900b00274df6d4c38si564249pjb.89.2023.10.31.00.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 00:18:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=hNxmtqR1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 60390803F979; Tue, 31 Oct 2023 00:18:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343523AbjJaHRo (ORCPT + 99 others); Tue, 31 Oct 2023 03:17:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229836AbjJaHRn (ORCPT ); Tue, 31 Oct 2023 03:17:43 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6B6D1C0; Tue, 31 Oct 2023 00:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=6VOEl ouc2GMG6bSXp2UcAdff2CtTi6AX9Q0p7itVxKA=; b=hNxmtqR1fN7BA3q1g2ICx VRxNm0SfZHNYL8L8HAhhbgtHVZzrPE1itUvu7NgCwp0KV49XJXkpVznmWmoByFuM ZYiUfcvatLYHhxg7N8z/1ySEFYA3dV9lQPRlnpf4eOujyUP0z17QjALMBAKvGuE9 +Wfd3c+X9AnW5EUCrnsBaU= Received: from leanderwang-LC4.localdomain (unknown [111.206.145.21]) by zwqz-smtp-mta-g3-3 (Coremail) with SMTP id _____wBn3ojfqUBlwMj4AQ--.51864S2; Tue, 31 Oct 2023 15:16:48 +0800 (CST) From: Zheng Wang To: dmitry.osipenko@collabora.com Cc: Kyrie.Wu@mediatek.com, bin.liu@mediatek.com, mchehab@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Irui.Wang@mediatek.com, security@kernel.org, hackerzheng666@gmail.com, 1395428693sheep@gmail.com, alex000young@gmail.com, amergnat@baylibre.com, wenst@chromium.org, Zheng Wang Subject: [PATCH v2 0/3] Fix use-after-free bug in mtk_jpeg_dec_device_run Date: Tue, 31 Oct 2023 15:16:41 +0800 Message-Id: <20231031071644.20086-1-zyytlz.wz@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wBn3ojfqUBlwMj4AQ--.51864S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Jw4xJry8Zw1DWryDtw4DCFg_yoWkArX_WF 9Y9wn7uw18G3srJF4ayFy5ZrW8GFy7KF45GFZ8KFs5JFy5XFZIqF1vyrZ3uan3Wa12vF43 Gr4FqF4UXw1j9jkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xR_1v3UUUUUU== X-Originating-IP: [111.206.145.21] X-CM-SenderInfo: h2113zf2oz6qqrwthudrp/xtbBdgAaU2DkptftmgAAs9 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 00:18:03 -0700 (PDT) Hello, This v2 series fixes the use-after-free bug in mtk_jpeg_dec_device_run. It inclues reverting the incomplete fix before and make the right fix. Also,it fixes the error of timeout-worker-schedule in multiple-core devices. 1. Remove cancel worker in mtk_jpeg_remove for the worker is only registered in single-core device but we try to cacnel it in both single-core and multiple-core devices. 2. Fix use-after-free bug by delay the schedule_delayed_work only if mtk_jpeg_set_dec_dst runs successfully. 3. Delay the schedule_delayed_work in mtk_jpegdec_worker as it has same code logic in mtk_jpeg_dec_device_run. version 2 changes -put the patches into on series suggested by Dmitry Zheng Wang (3): media: mtk-jpeg: Remove cancel worker in mtk_jpeg_remove to avoid the crash of multi-core JPEG devices media: mtk-jpeg: Fix use after free bug due to error path handling in mtk_jpeg_dec_device_run media: mtk-jpeg: Fix timeout schedule error in mtk_jpegdec_worker. .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) -- 2.25.1