Received: by 10.213.65.68 with SMTP id h4csp36568imn; Mon, 19 Mar 2018 18:44:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELtd3oR707oW9bjlvvLLBPx0FiyBD5cJEXR7iQ6foyDh5PZUTWs+S8dOMaQ7G5CumHoR0EYB X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr14904983pls.58.1521510240710; Mon, 19 Mar 2018 18:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510240; cv=none; d=google.com; s=arc-20160816; b=ONDB9MRHbr+P4SAmbqK6f65XnbuYHmMeC6uJY+1nDdiHadaDGcusWu62pGCH10z1RM WqtGhuhPwIzBMMpMyMgHGEcbNAbBR6CupgPjr4D810Gsyz79QJb32xPkNk5bf0wzdS7U m+rIGqf71j2aQAkCSkSO7D3yOaC5Eb85amW1A11qSMZak/nTDUJpwvJEoQOCRMqO+7Ly CYwpQcnClghuiFqIUV9qvMClXtSwbCVNlQYFaZdDlHPsU+kqvxKSO+I9GGIm1mQbTTGn 5Zamv1OLmXD6PG7ydQiE/p3AA6ET3fRPvP1Ctlz10EtwNKrhkH2lVOEpDWNoRzU+JJvb LmXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=w+uFfTSZyJxTHcDLyDKptn9AQU8ua98p+2Rrmn9mGbk=; b=lcAI94XHMP60o1ywjoJh/yizo9jz4MsLfmBnlRRy8jHTxfqhvC5A/Jv8xzQSfx24YA 9lJwoZnVl1xMHOHHmTrA3sKkW0/gCsTTxXUTq8E+CvaSw4xGWIaIPzJYRVWYuW1yOMfD Z/sVZz4CkzLWkOS6oiaCaMSDvNVxMvBOUbEjtEjgisaXlFa/f9bc+ShYyS/eCvOoAt8T txXG7wxmHxOSBLEdfN7Th/ORbeBjofbvvLL0MuIFiz/UlSwZUdjsA3sfzShBco+ugAq8 SF2KP7fbN8WKdSUqhIRqE26NKSCJiKNK3v/EPF96y7tRaZueee6VAEdCfTGdpTsNvAMZ W7wA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si509758pls.108.2018.03.19.18.43.45; Mon, 19 Mar 2018 18:44:00 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032106AbeCSSb3 (ORCPT + 99 others); Mon, 19 Mar 2018 14:31:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53552 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032052AbeCSSbY (ORCPT ); Mon, 19 Mar 2018 14:31:24 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C6168103C; Mon, 19 Mar 2018 18:31:23 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre Moreau , Lukas Wunner , Ben Skeggs Subject: [PATCH 4.15 15/52] drm/nouveau/bl: Fix oops on driver unbind Date: Mon, 19 Mar 2018 19:08:13 +0100 Message-Id: <20180319180736.000818984@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180734.976730813@linuxfoundation.org> References: <20180319180734.976730813@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Lukas Wunner commit 76f2e2bc627f7d08360ac731b6277d744d4eb599 upstream. Unbinding nouveau on a dual GPU MacBook Pro oopses because we iterate over the bl_connectors list in nouveau_backlight_exit() but skipped initializing it in nouveau_backlight_init(). Stacktrace for posterity: BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: nouveau_backlight_exit+0x2b/0x70 [nouveau] nouveau_display_destroy+0x29/0x80 [nouveau] nouveau_drm_unload+0x65/0xe0 [nouveau] drm_dev_unregister+0x3c/0xe0 [drm] drm_put_dev+0x2e/0x60 [drm] nouveau_drm_device_remove+0x47/0x70 [nouveau] pci_device_remove+0x36/0xb0 device_release_driver_internal+0x157/0x220 driver_detach+0x39/0x70 bus_remove_driver+0x51/0xd0 pci_unregister_driver+0x2a/0xa0 nouveau_drm_exit+0x15/0xfb0 [nouveau] SyS_delete_module+0x18c/0x290 system_call_fast_compare_end+0xc/0x6f Fixes: b53ac1ee12a3 ("drm/nouveau/bl: Do not register interface if Apple GMUX detected") Cc: stable@vger.kernel.org # v4.10+ Cc: Pierre Moreau Signed-off-by: Lukas Wunner Signed-off-by: Ben Skeggs Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/nouveau/nouveau_backlight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c @@ -268,13 +268,13 @@ nouveau_backlight_init(struct drm_device struct nvif_device *device = &drm->client.device; struct drm_connector *connector; + INIT_LIST_HEAD(&drm->bl_connectors); + if (apple_gmux_present()) { NV_INFO(drm, "Apple GMUX detected: not registering Nouveau backlight interface\n"); return 0; } - INIT_LIST_HEAD(&drm->bl_connectors); - list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && connector->connector_type != DRM_MODE_CONNECTOR_eDP)