Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2834491yba; Mon, 22 Apr 2019 13:56:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGoUpXCBMMoSbdwvZEvzeskWDoVmD1ozstBCqZztEsndjwRXPGaiqdmBvEqSKxwGrOgoVB X-Received: by 2002:a17:902:e406:: with SMTP id ci6mr3241026plb.196.1555966588142; Mon, 22 Apr 2019 13:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555966588; cv=none; d=google.com; s=arc-20160816; b=gOJOs29sKJWAKFtMVNZiA2wSlSEZ3WmOdMye9KuRVVOExx7F7rzmum+J/gzfz94+/E AgswheVhJ3yVKyo84vTMe7uCGAMlo7yQx/P+kHxktIObBpbKDs9J2okoza7GhxAHHHdL F6onBEfuEnS4BO7dONltJrYXnH1PjI3KtorlOEICDhY29Yq0Px8chQ2RrCnVoIgBdpMS +dJ4rnjrja/8o5IyawRR8HbJxl1yDSeZfcUcf8sqg4POcYQwUW5m34LLdiXPvFGYPbqm XjVRrMYqK8JBLeIp3ZBdmWKs7qwZx3md0tYrEsnAgQZjOIP2uV3ito0Fg7YtkH4S3bYx x2rQ== 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=E1S/yfmhODK7pL9aGxJGX4B+GqYntAo81yiVfmckWQg=; b=hfbao3JgL3EJ6iFZfjQaGN8DQbSY20gL9tFnq/NMnv3T7a5Azd5R6Q6qm4WqnmwHmn FGqOIeyXT/njouhGwjtTB3VCMtwcBWokblXqEiY0HxdX8MzdQ1LOVN6PGc/El56qZjTk S+ny90LMFH+9OmUBodNDrn46JWIdyZdGvRDfSNVv8ZCo6B9u/9OVz+/VQKqyxVXElY7R RidVo8khuxTejed+ut4Z3cWnRjrXlPdGvJKaOX3i90TggqMTfAeBtjdXD96jQpUfNq4W uwd5x6XCC7XEE2AvSE+syKtBf9218T9hb1zpWIhlF23yDQVvHRfZ/unvJElkNujj5UC9 fVoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hLOnVKpX; 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 u1si14506917pfa.222.2019.04.22.13.56.12; Mon, 22 Apr 2019 13:56:28 -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=hLOnVKpX; 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 S1729328AbfDVTn7 (ORCPT + 99 others); Mon, 22 Apr 2019 15:43:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:44742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729309AbfDVTn5 (ORCPT ); Mon, 22 Apr 2019 15:43:57 -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 BB8C521901; Mon, 22 Apr 2019 19:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962236; bh=FuDcAin+IjuMiPtgjpgAA5UrwqlL8qLDmzQSajn3e9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hLOnVKpXsVm/qqo2NmIC8Mmr8x4Lz+PCpa7+WlBruiYcVFaQxQi0syM2L6q0Jt2ms xRAbhuxSArNN9cISmKGN/JPxg5tpAVutFwnaWjiyCPexkbs9T9W/8W0nDKhk9CdBiN nsOKtB4AOLaLwN4A2gitWLPGfAiI86j+zEE/PiA0= 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 5.0 56/98] drm/meson: Fix invalid pointer in meson_drv_unbind() Date: Mon, 22 Apr 2019 15:41:23 -0400 Message-Id: <20190422194205.10404-56-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-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 776e78677f514ecddd12dba48b9040958999bd5a ] meson_drv_bind() registers a meson_drm struct as the device's privdata, but meson_drv_unbind() tries to retrieve a drm_device. This may cause a segfault on shutdown: [ 5194.593429] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000197 ... [ 5194.788850] Call trace: [ 5194.791349] drm_dev_unregister+0x1c/0x118 [drm] [ 5194.795848] meson_drv_unbind+0x50/0x78 [meson_drm] Retrieve the right pointer in meson_drv_unbind(). 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-1-jean-philippe.brucker@arm.com Signed-off-by: Sasha Levin (Microsoft) --- drivers/gpu/drm/meson/meson_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 12ff47b13668..c1115a96453f 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -336,8 +336,8 @@ static int meson_drv_bind(struct device *dev) static void meson_drv_unbind(struct device *dev) { - struct drm_device *drm = dev_get_drvdata(dev); - struct meson_drm *priv = drm->dev_private; + struct meson_drm *priv = dev_get_drvdata(dev); + struct drm_device *drm = priv->drm; if (priv->canvas) { meson_canvas_free(priv->canvas, priv->canvas_id_osd1); -- 2.19.1