From patchwork Mon Oct 24 11:33:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp556305wru; Mon, 24 Oct 2022 10:01:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5sOkdtf27Qg8vzEHlAMA/a/FbIZDWJLyYoIXIVqd6oYjBhLgX+veugl23bBxRl4Wk6hlx3 X-Received: by 2002:a63:f056:0:b0:46e:99bb:166d with SMTP id s22-20020a63f056000000b0046e99bb166dmr19778903pgj.480.1666630888107; Mon, 24 Oct 2022 10:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666630888; cv=none; d=google.com; s=arc-20160816; b=tLRy2IZFjlP2mJI/zgFDxLIA9G2a3EG3N+aej62EhBB5poW5AWQUp7m/2kncBuI7tJ KQfpGAtKkUfxDomVP2aFgP7fXCgvwVGPXfY1WDq5XM9LFKe6TLKEemAqdRqgUxcv4inH aWQqgPyGP8HuAdLKelqOksQh2qL/UFj5v4R4oQmnlMSYIrOOKSMwZY/+akBeO1LIQ7MI MmvLQswMGHpELC12+U1gAyht0ijGaurX1+yL5s9BPwABana+GT3w9ESFBVJiSL71QLNy 2QTArIvjJ40BbBQ+3wXnPFNv0sf7PrFDe5d6+kt/Q5rtNqgOyYUYbmrzXEIMKdU3x/Lr /5yA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FMvWmbI67JqC5C59JgViedpFg9aFX60Wvv+SkOZsV4g=; b=uDmFQGH5PoylYvDRaixgjJbYTyD5W9G43bo6booCQL+XksH5IZ5jLPfwcZS+3hjroJ x+xkvaFjId8AdKGX3nGvwYThas/C8UsE5V1dJOw12giYYYdJq+7XD8vGWtJf0j1A9YI0 ejdyEQ09NNJXKg/OPgTGO5T8EgMYtt/0cdWXs/f88/6LWpBr47nzmfQ+BPgMREjzP4b2 DR3h75NOal6LgTke6AJKH7j1oZrxcijnSaawnvpOYHVSUiWVcMmpuxtf+XJofKL2IZC6 7TNDmgMpiH0Y6O3qGcfn0nBnRC5aaN5lVnkEV6Y6GbaDBTFhClDTNnj+ixJfDgH0SwC3 wuyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SuA0Wo0S; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bw18-20020a17090af61200b00212f05e6a86si376328pjb.112.2022.10.24.10.01.03; Mon, 24 Oct 2022 10:01:28 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SuA0Wo0S; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235395AbiJXQye (ORCPT + 99 others); Mon, 24 Oct 2022 12:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235495AbiJXQtq (ORCPT ); Mon, 24 Oct 2022 12:49:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32896CF866; Mon, 24 Oct 2022 08:32:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 614EBB819B4; Mon, 24 Oct 2022 12:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE5DBC433C1; Mon, 24 Oct 2022 12:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666616038; bh=i1lndpiEkYrYAtQpDMBbdOudkzLK1aVb7W6EgX5Yd3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuA0Wo0SgEKyCH4in67v0+vRgOi27B7sPtUh5tKf/fwpl9VKz7GW6Ce5E42SO+ltr GYudiIEMKK2takcMTkN2m0oLgf3QzgAK9vTMmW7aYiMkdLCll3mmbtTP+lkvHsEjTF hJZ54LvVazV3tXHbS26fZTgRiFfs41b3lgPtFue4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 478/530] media: platform: fix some double free in meson-ge2d and mtk-jpeg and s5p-mfc Date: Mon, 24 Oct 2022 13:33:42 +0200 Message-Id: <20221024113106.686319090@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113044.976326639@linuxfoundation.org> References: <20221024113044.976326639@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747589150256071666?= X-GMAIL-MSGID: =?utf-8?q?1747589150256071666?= From: Hangyu Hua [ Upstream commit c65c3f3a2cbf21ed429d9b9c725bdb5dc6abf4cf ] video_unregister_device will release device internally. There is no need to call video_device_release after video_unregister_device. Signed-off-by: Hangyu Hua Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/meson/ge2d/ge2d.c | 1 - drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 1 - drivers/media/platform/s5p-mfc/s5p_mfc.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/media/platform/meson/ge2d/ge2d.c b/drivers/media/platform/meson/ge2d/ge2d.c index a373dea9866b..a885cbc99e38 100644 --- a/drivers/media/platform/meson/ge2d/ge2d.c +++ b/drivers/media/platform/meson/ge2d/ge2d.c @@ -1032,7 +1032,6 @@ static int ge2d_remove(struct platform_device *pdev) video_unregister_device(ge2d->vfd); v4l2_m2m_release(ge2d->m2m_dev); - video_device_release(ge2d->vfd); v4l2_device_unregister(&ge2d->v4l2_dev); clk_disable_unprepare(ge2d->clk); diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index a89c7b206eef..470f8f167744 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -1457,7 +1457,6 @@ static int mtk_jpeg_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); video_unregister_device(jpeg->vdev); - video_device_release(jpeg->vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); mtk_jpeg_clk_release(jpeg); diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index f336a9543273..4fc135d9f38b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1406,6 +1406,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) /* Deinit MFC if probe had failed */ err_enc_reg: video_unregister_device(dev->vfd_dec); + dev->vfd_dec = NULL; err_dec_reg: video_device_release(dev->vfd_enc); err_enc_alloc: @@ -1451,8 +1452,6 @@ static int s5p_mfc_remove(struct platform_device *pdev) video_unregister_device(dev->vfd_enc); video_unregister_device(dev->vfd_dec); - video_device_release(dev->vfd_enc); - video_device_release(dev->vfd_dec); v4l2_device_unregister(&dev->v4l2_dev); s5p_mfc_unconfigure_dma_memory(dev);