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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C0B3C61DA4 for ; Mon, 6 Mar 2023 14:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229850AbjCFOsQ (ORCPT ); Mon, 6 Mar 2023 09:48:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbjCFOsL (ORCPT ); Mon, 6 Mar 2023 09:48:11 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2835E1986 for ; Mon, 6 Mar 2023 06:47:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678114005; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ePnoIICLAgX5+yYDBioH0vdLJ6br42cKaUY5oT5Uciw=; b=Iijr6J1yVDJFdXagEsoBUptSQ7bsMddbGYbDNUzbx7DJSBBjpO0c86A841zIkIZfYKI1he siSm1B+jTZkt8EtaigTRk/yYP/iykkDZRHp9rcz0LBqPeEf6a8DWEF0P3DpSrSFI6GejFi A7lUEXAolhl1v90tBSa5Ixo2pcSgUUo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-343-su8vUQvyPQKmkMm2FULrTQ-1; Mon, 06 Mar 2023 09:46:43 -0500 X-MC-Unique: su8vUQvyPQKmkMm2FULrTQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D50B229AA39C; Mon, 6 Mar 2023 14:46:42 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87CDE1410DD9; Mon, 6 Mar 2023 14:46:42 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 05829180062C; Mon, 6 Mar 2023 15:46:40 +0100 (CET) Date: Mon, 6 Mar 2023 15:46:40 +0100 From: Gerd Hoffmann To: Dmitry Osipenko Cc: Rob Clark , Gurchetan Singh , Chia-I Wu , Ryan Neph , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas , David Airlie , kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2] drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS option Message-ID: <20230306144640.ta7jca5iabg66uoy@sirius.home.kraxel.org> References: <20230306143234.1561759-1-dmitry.osipenko@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230306143234.1561759-1-dmitry.osipenko@collabora.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 06, 2023 at 05:32:34PM +0300, Dmitry Osipenko wrote: > VirtIO-GPU got a new config option for disabling KMS. There were two > problems left unnoticed during review when the new option was added: > > 1. The IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS) check in the code was > inverted, hence KMS was disabled when it should be enabled and vice versa. > > 2. The disabled KMS crashed kernel with a NULL dereference in > drm_kms_helper_hotplug_event(), which shall not be invoked with a > disabled KMS. > > Fix the inverted config option check in the code and skip handling the > VIRTIO_GPU_EVENT_DISPLAY sent by host when KMS is disabled in guest to fix > the crash. > > Fixes: 72122c69d717 ("drm/virtio: Add option to disable KMS support") > Signed-off-by: Dmitry Osipenko > --- > > Changelog: > > v2: - Moved the "has_edid" under the "num_scanouts" condition, like was > suggested by Gerd Hoffmann. Acked-by: Gerd Hoffmann