Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3085404yba; Mon, 22 Apr 2019 19:34:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVnnfCu9bnDvwnnn6WbU/H6DJJL6OvOu+m6ewc5sGnnHmbyns/8hZF0r+zzOogC28Ywsrp X-Received: by 2002:a17:902:820a:: with SMTP id x10mr24050228pln.316.1555986898810; Mon, 22 Apr 2019 19:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555986898; cv=none; d=google.com; s=arc-20160816; b=dInlgTKsad4jeLuNkx6Z1pTWLwPlIOYhElSI3S3/cH1/YSFseSgUYaIyCJ/wXT0+33 drPLNp61uEFJDfnZzKokwZTItD8yYjp5fxgCHmjrNzlLuXZn0/50U9jCV54vAqL62vN9 aPcNi4uFY5VExbCZdT+Bq6PfGnLgfZq3wltNHmYa2H0lcPzXQhhV3WJLfdLT9AQ+NufO Rks6NACHM3lTxu7aFTu57el9t8k6n+arz0vFwa2Um0MbID47rwYugajLaV6kfI5UzE5x MYo6KEirH1xDVE20/pP34yigcG5HtA1d27HvDJk3M0S8OU4YPkRFCB+Vxoxqg7WTq/WH DlmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jbamgvzQ3s/MB1WSAdtdtC6yWzY71qFEM34LbZIsvX4=; b=LZlk4wXve/d+9BpNgMGTgW8EO0PSg2GzHWiErueg1dTJaV3QKlxxeRyaBs7c0KyOGk rvGtDozxNXkwZBEWIUuihWqOy4uh94HKWwhGzjnuKfbiwdMbIW2nN7FJDFvRs8JyVnEu Z6Gr/x89gZlRpLJ89vCR6zIQ9swtE0OVm7E/UyEyeRpeA0sLIgNBqspmibIQDsWeWTVt Tlhqu/eIOcNxAiDjna324wfUvo9uFSX95oWlEFB53v6JnPOyVIFstea3JiWV9TOqPjTh WVfCxA/3zBZA0LTwLhF7NMSxoxC0DpHJwWsUWMVSpGNcO2rk+lnXjD32Ikk9LFpvgGXn tlVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GfJbiRfW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t36si1101928pgl.371.2019.04.22.19.34.42; Mon, 22 Apr 2019 19:34:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GfJbiRfW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731995AbfDVUBk (ORCPT + 99 others); Mon, 22 Apr 2019 16:01:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:49286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730097AbfDVTqv (ORCPT ); Mon, 22 Apr 2019 15:46:51 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B812321902; Mon, 22 Apr 2019 19:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962410; bh=LSqPcGYBte/5EODLqxzqi8NE6nDqGEBNjyvrZqYI0kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GfJbiRfWVdd45ZJb4c14mpdrty3FMsYANdLuYW/VY6sFiH018nZJN1JMmYaidMJcy /urDR7K9q+Aw/XbsJx/I4MgyiV2S0MKgp7w4toZG2hmPv8WtgH1kz/dflcnVprtmeU PYh6xu9nl5VrpiWUZAeBuHBSVpjMC8bIH6+7XiDU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jean-Philippe Brucker , Neil Armstrong , Sasha Levin , dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org Subject: [PATCH AUTOSEL 4.19 46/68] drm/meson: Uninstall IRQ handler Date: Mon, 22 Apr 2019 15:44:54 -0400 Message-Id: <20190422194516.11634-46-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jean-Philippe Brucker [ Upstream commit 2d8f92897ad816f5dda54b2ed2fd9f2d7cb1abde ] meson_drv_unbind() doesn't unregister the IRQ handler, which can lead to use-after-free if the IRQ fires after unbind: [ 64.656876] Unable to handle kernel paging request at virtual address ffff000011706dbc ... [ 64.662001] pc : meson_irq+0x18/0x30 [meson_drm] I'm assuming that a similar problem could happen on the error path of bind(), so uninstall the IRQ handler there as well. Fixes: bbbe775ec5b5 ("drm: Add support for Amlogic Meson Graphic Controller") Signed-off-by: Jean-Philippe Brucker Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20190322152657.13752-2-jean-philippe.brucker@arm.com Signed-off-by: Sasha Levin (Microsoft) --- drivers/gpu/drm/meson/meson_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 4a72fa53a1d5..588b3b0c8315 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -300,10 +300,12 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) ret = drm_dev_register(drm, 0); if (ret) - goto free_drm; + goto uninstall_irq; return 0; +uninstall_irq: + drm_irq_uninstall(drm); free_drm: drm_dev_put(drm); @@ -321,6 +323,7 @@ static void meson_drv_unbind(struct device *dev) struct drm_device *drm = priv->drm; drm_dev_unregister(drm); + drm_irq_uninstall(drm); drm_kms_helper_poll_fini(drm); drm_fbdev_cma_fini(priv->fbdev); drm_mode_config_cleanup(drm); -- 2.19.1