lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAAOTY_9uEACFCT6k9FaDqu4WN+e2CiJqWXOb20sWa1jXbCfc_A@mail.gmail.com>
Date:   Wed, 29 Sep 2021 22:53:08 +0800
From:   Chun-Kuang Hu <chunkuang.hu@...nel.org>
To:     "jason-jh.lin" <jason-jh.lin@...iatek.com>
Cc:     Chun-Kuang Hu <chunkuang.hu@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Yongqiang Niu <yongqiang.niu@...iatek.com>,
        DRI Development <dri-devel@...ts.freedesktop.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Hsin-Yi Wang <hsinyi@...omium.org>, fshao@...omium.org,
        Nancy Lin <nancy.lin@...iatek.com>, singo.chang@...iatek.com
Subject: Re: [PATCH 2/3] drm/mediatek: Fix pkt buf alloc once but free many times

Hi, Jason:

jason-jh.lin <jason-jh.lin@...iatek.com> 於 2021年9月29日 週三 下午3:02寫道:
>
> Because mtk_drm_crt_cmdq_pkt_create is called once
> in mtk_drm_crtc_create, the pkt should not be destroy
> at ddp_cmdq_cb.
>
> So move mtk_drm_crtc_pkt_destroy to mtk_drm_crtc_destroy.

Reviewed-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>

>
> Fixes: bc9241be73d9 ("drm/mediatek: Add cmdq_handle in mtk_crtc")
> Signed-off-by: jason-jh.lin <jason-jh.lin@...iatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 29 +++++++++++++++----------
>  1 file changed, 18 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> index e98871a8c961..06342df2a0be 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c
> @@ -108,12 +108,30 @@ static void mtk_drm_finish_page_flip(struct mtk_drm_crtc *mtk_crtc)
>         }
>  }
>
> +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> +static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
> +{
> +       struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
> +
> +       dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
> +                        DMA_TO_DEVICE);
> +       kfree(pkt->va_base);
> +       kfree(pkt);
> +}
> +#endif
> +
>  static void mtk_drm_crtc_destroy(struct drm_crtc *crtc)
>  {
>         struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc);
>
>         mtk_mutex_put(mtk_crtc->mutex);
> +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> +       mtk_drm_cmdq_pkt_destroy(&mtk_crtc->cmdq_handle);
>
> +       if (mtk_crtc->cmdq_client.chan)
> +               mbox_free_channel(mtk_crtc->cmdq_client.chan);
> +                                 mtk_crtc->cmdq_client.chan = NULL;
> +#endif
>         drm_crtc_cleanup(crtc);
>  }
>
> @@ -255,16 +273,6 @@ static int mtk_drm_cmdq_pkt_create(struct cmdq_client *client, struct cmdq_pkt *
>         return 0;
>  }
>
> -static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)
> -{
> -       struct cmdq_client *client = (struct cmdq_client *)pkt->cl;
> -
> -       dma_unmap_single(client->chan->mbox->dev, pkt->pa_base, pkt->buf_size,
> -                        DMA_TO_DEVICE);
> -       kfree(pkt->va_base);
> -       kfree(pkt);
> -}
> -
>  static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
>  {
>         struct cmdq_cb_data *data = mssg;
> @@ -302,7 +310,6 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg)
>         }
>
>         mtk_crtc->cmdq_vblank_cnt = 0;
> -       mtk_drm_cmdq_pkt_destroy(pkt);
>  }
>  #endif
>
> --
> 2.18.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ