From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DDCBC7EE23 for ; Tue, 30 May 2023 22:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M7QaWObStTn3Dhj/OOIw00oHqu7ajTYIfVTLLIkoMSg=; b=tJ7cES0odYhJjI emh6Gxvoh8p2bDpIByypm1sLSiIlxqiEJP65nO4pMubY8kRL0rRHaOmDkn5QDN4zpAvhAMy5PPwFr nE8MjZxQb56kvtmzJDmt2/C3onfPLB56u/0Ly5QtaTbUtD9DQXR6oMj1d2sRTiXn0TBypwCMUsg28 wCmGFZaUjbXJJYfPfVyYjHn/WCU83cyslsepanGqk1XwnCA9NFRDUF2Val7thpTbtWiACSLMDN7cX QKd44b4Dic+ruvtkp8q6IzgkB2KeykHDwM78VFnsXmjDcTWERjsIcB5jorDLAN+Yuo3ymvesG0OsK UuX82LeAKURRZ0hdEw8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q47j5-00FIfK-1J; Tue, 30 May 2023 22:21:59 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q47j1-00FIed-0a for linux-arm-kernel@lists.infradead.org; Tue, 30 May 2023 22:21:56 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 83D4263493; Tue, 30 May 2023 22:21:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E71C433D2; Tue, 30 May 2023 22:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685485314; bh=KIc/pp1lOWtTgIyst2JNrfoGv5WLci5gKABpg1IBUx8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lrm6iAfkq5oCiLKo3eLSlvibhpItzBRgAlKYT1IbbWm4DhfffmNQ5Kbkc5IMBT+dQ z/BlERcBVmq+eA3PmJ925+zx3TlxlFkZYRtmlegS3m6V74SYfGu/9bg/UOaydE+2wA UE2jROuXxcjlOZuPyXn+MNvP036ABcil7TWUoev531/tJhsptWY1FlLboQPsOy8m4Z XE7Wuy52mG5UcB2uKJXLZt3fVOMRmQ9DSaEWmQluiaaOHmtoNLJzzQf8novuLLn8D0 WHk1ok406k2DSu0ootecDRmT8bcqBgN4vn8yYuw25dS45x9pReZlAdQ7zrErXV+q8f MknRyZ6XAPF+A== Date: Wed, 31 May 2023 00:21:50 +0200 From: Andi Shyti To: Min Li Cc: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/exynos: fix race condition UAF in exynos_g2d_exec_ioctl Message-ID: <20230530222150.24oogloda6wtvpvm@intel.intel> References: <20230526130131.16521-1-lm0963hack@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230526130131.16521-1-lm0963hack@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230530_152155_287530_A59AA31B X-CRM114-Status: GOOD ( 20.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Min, On Fri, May 26, 2023 at 09:01:31PM +0800, Min Li wrote: > If it is async, runqueue_node is freed in g2d_runqueue_worker on another > worker thread. So in extreme cases, if g2d_runqueue_worker runs first, and > then executes the following if statement, there will be use-after-free. > > Signed-off-by: Min Li > --- > drivers/gpu/drm/exynos/exynos_drm_g2d.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c > index ec784e58da5c..414e585ec7dd 100644 > --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c > +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c > @@ -1335,7 +1335,7 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, > /* Let the runqueue know that there is work to do. */ > queue_work(g2d->g2d_workq, &g2d->runqueue_work); > > - if (runqueue_node->async) > + if (req->async) did you actually hit this? If you did, then the fix is not OK. Andi > goto out; > > wait_for_completion(&runqueue_node->complete); > -- > 2.34.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel