Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2524011yba; Mon, 15 Apr 2019 13:32:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCeib8gpKJ3cUJpg9C3AhWebbxS0nB4cKWlct1xuOmmpNG1cMRZ3q8ct2VZKRvujja7B7V X-Received: by 2002:a63:b305:: with SMTP id i5mr68860800pgf.274.1555360364680; Mon, 15 Apr 2019 13:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555360364; cv=none; d=google.com; s=arc-20160816; b=bbM5QaOK3NRafrEu7P23xIugulnsqNLiyInyURCi3JHEClZtq07SWoh81xtTGJ3pBq CNPD2oRTLewvJs6wT5UCcE3YJfJl1TuQLUXYD18/nWpnYKW/KFjF8zQfTYMmNaIWUG6z Dvga9I3bGan9xivOmFwSeoxORcVcCUYq1ZASTRUxId40vzDgiKUiHJJSmy2nivA5AGun JFmNjt3iAYNF7nkivLlyivLsYNxXTUE3gpShXnW0bH3FoI4XCcKOqC0riMoS5qHFiFKv rjSg5nVqXpS6VtCDBlby4BmsuKSHp4BWRLLLuvjyNPWJ1tnFF5WwhoNizlg8vNtaAGuc lFFA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5O0qEpehYtRhfQ2zl1xLZskTvEDxb2hTtc9orpuwRVI=; b=gSK7IqIrWsNP/P9XhyMGQk7fPUr5IcESZVT2zB1csPArpz7fZsEvaUkwal/d+mI185 7ikNjbLPDmmOlISpX/Xdo250akTnFbPz7tliDNa3PYfU08bO2BvK8m6QiLGjiqRPUo29 iJ4vg5kp/eHnvaJV/vilecp8dNF85nuCkzf892irlQoJwyVbVXjYTjeBJH7mgV5xHE0h JBfBtMT3yfP9KlnM61crHs2xY+QM+s+YBeWuuuV3GisS4ETZdq7KcOT0nWLTvT9H9rXN XimhRa8G8NM54eLjCWNStXAOtMbV3embuhufnfLoCCNA3Mz1Yeu5jhT0875zHFz3hsJM Qtaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="DpbDuz/K"; 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 q137si44546371pgq.58.2019.04.15.13.32.28; Mon, 15 Apr 2019 13:32:44 -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="DpbDuz/K"; 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 S1730878AbfDOTWf (ORCPT + 99 others); Mon, 15 Apr 2019 15:22:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:43358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729623AbfDOTIH (ORCPT ); Mon, 15 Apr 2019 15:08:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 082942087C; Mon, 15 Apr 2019 19:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355286; bh=pQYJmHJT7PBNeH2DZM8AKGRrSD7/IDnhcH7KXwxPyTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DpbDuz/KwJ1E7reAEnE9v7xEd35WjDVP0hhISvnfVNTR7XKubManiDjt/v4eOn0RL GqOwQxygyzjPTt5EOSpylBc74YanyK9WcqQZJkUj2RpnziYUnWK0fV8tqdQViTaLrC hL84Ftu2ToqbqyyAZ5Uu4BlxHzT75f9UPtVYTlPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Dave Airlie Subject: [PATCH 4.19 061/101] drm/udl: add a release method and delay modeset teardown Date: Mon, 15 Apr 2019 20:58:59 +0200 Message-Id: <20190415183743.729868656@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Airlie commit 9b39b013037fbfa8d4b999345d9e904d8a336fc2 upstream. If we unplug a udl device, the usb callback with deinit the mode_config struct, however userspace will still have an open file descriptor and a framebuffer on that device. When userspace closes the fd, we'll oops because it'll try and look stuff up in the object idr which we've destroyed. This punts destroying the mode objects until release time instead. Cc: stable@vger.kernel.org Reviewed-by: Daniel Vetter Signed-off-by: Dave Airlie Link: https://patchwork.freedesktop.org/patch/msgid/20190405031715.5959-2-airlied@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/udl/udl_drv.c | 1 + drivers/gpu/drm/udl/udl_drv.h | 1 + drivers/gpu/drm/udl/udl_main.c | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c @@ -51,6 +51,7 @@ static struct drm_driver driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, .load = udl_driver_load, .unload = udl_driver_unload, + .release = udl_driver_release, /* gem hooks */ .gem_free_object_unlocked = udl_gem_free_object, --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h @@ -104,6 +104,7 @@ void udl_urb_completion(struct urb *urb) int udl_driver_load(struct drm_device *dev, unsigned long flags); void udl_driver_unload(struct drm_device *dev); +void udl_driver_release(struct drm_device *dev); int udl_fbdev_init(struct drm_device *dev); void udl_fbdev_cleanup(struct drm_device *dev); --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c @@ -378,6 +378,12 @@ void udl_driver_unload(struct drm_device udl_free_urb_list(dev); udl_fbdev_cleanup(dev); - udl_modeset_cleanup(dev); kfree(udl); } + +void udl_driver_release(struct drm_device *dev) +{ + udl_modeset_cleanup(dev); + drm_dev_fini(dev); + kfree(dev); +}