From mboxrd@z Thu Jan 1 00:00:00 1970 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 C1C07C43217 for ; Mon, 31 Jan 2022 21:07:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350833AbiAaVHU (ORCPT ); Mon, 31 Jan 2022 16:07:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379839AbiAaVGt (ORCPT ); Mon, 31 Jan 2022 16:06:49 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB303C061758 for ; Mon, 31 Jan 2022 13:06:42 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id e8so27971157wrc.0 for ; Mon, 31 Jan 2022 13:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=XB0If8d+oNzt5EGFOz/pJSfVqwossHreq5Z3/8sGNGT1tWVb8HeX+PuSX4HzuKCtxL 85Ce3vd3TA/uayqURoZ6LVnYYD+zcPj1L3cM6aaDGzt5LCXHqB2YeYKof0DAcvGHjWoE WAj/NXLBP9zyNJqrR3yjJ4zw+CAjDKmq/tKN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=wBfIWViVjVtpl4Ozd6xD3UXxXnKDo3sZO1qfgic4Ae9IF7z23R7G8/5z8LMIJib/4r ToX8S2JnSxjRunzKOSxjfVtjtxmULjL0sUAAqNC2p13qRfX6rWBoe6Q2SNoB9fYdijyS 6NtdErApq6FK6JCrdZ2CgTe1yWl1no+DnEC01Yt1s0POjdDmEilKB+4TZSx2nwgVn9fc P8OEsYFojxtJTdjNPz2stZuSFMIdRaIeXPDG6w4Brad/SUCy5g/yKOxfRCacyrj3Pkvh tMBk4YERFtfJNYvm6ziq+XFROmHAgf6JRSErvE6kX+LKHOliAJdoCf40xyXQkNL8BJgf x8uA== X-Gm-Message-State: AOAM531f/cYqwtFPXf0vrLvaK4Hg8uwHUmmzMey/H9yuB/rp4/FBm3VR h2RJvhtX7Lttit+McuaiEflVag== X-Google-Smtp-Source: ABdhPJyCY4pMX5KDnbLHXSX+AzjieeB1bfyqYC6ZVcKQr80N8d2mwo0uPWz2LhfKAg4dG48zDem7wQ== X-Received: by 2002:a05:6000:1d90:: with SMTP id bk16mr9737566wrb.217.1643663201557; Mon, 31 Jan 2022 13:06:41 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b11sm314961wmq.46.2022.01.31.13.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 13:06:41 -0800 (PST) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , linux-fbdev@vger.kernel.org, LKML , Daniel Vetter , Daniel Vetter , Helge Deller , Daniel Vetter , Qing Wang , Sam Ravnborg Subject: [PATCH 07/21] fbdev/sysfs: Fix locking Date: Mon, 31 Jan 2022 22:05:38 +0100 Message-Id: <20220131210552.482606-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220131210552.482606-1-daniel.vetter@ffwll.ch> References: <20220131210552.482606-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fb_set_var requires we hold the fb_info lock. Or at least this now matches what the ioctl does ... Note that ps3fb and sh_mobile_lcdcfb are busted in different ways here, but I will not fix them up. Also in practice this isn't a big deal, because really variable fbdev state is actually protected by console_lock (because fbcon just doesn't bother with lock_fb_info() at all), and lock_fb_info protecting anything is really just a neat lie. But that's a much bigger fish to fry. Signed-off-by: Daniel Vetter Cc: Helge Deller Cc: Daniel Vetter Cc: Qing Wang Cc: Sam Ravnborg --- drivers/video/fbdev/core/fbsysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 26892940c213..8c1ee9ecec3d 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -91,9 +91,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) var->activate |= FB_ACTIVATE_FORCE; console_lock(); + lock_fb_info(fb_info); err = fb_set_var(fb_info, var); if (!err) fbcon_update_vcs(fb_info, var->activate & FB_ACTIVATE_ALL); + unlock_fb_info(fb_info); console_unlock(); if (err) return err; -- 2.33.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FCD8C433F5 for ; Mon, 31 Jan 2022 21:07:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E8DA10E4A3; Mon, 31 Jan 2022 21:06:46 +0000 (UTC) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0488A10E494 for ; Mon, 31 Jan 2022 21:06:43 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id s18so27876305wrv.7 for ; Mon, 31 Jan 2022 13:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=XB0If8d+oNzt5EGFOz/pJSfVqwossHreq5Z3/8sGNGT1tWVb8HeX+PuSX4HzuKCtxL 85Ce3vd3TA/uayqURoZ6LVnYYD+zcPj1L3cM6aaDGzt5LCXHqB2YeYKof0DAcvGHjWoE WAj/NXLBP9zyNJqrR3yjJ4zw+CAjDKmq/tKN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=iyG/iBqZwCtsLLbVpDsXGNCnxGc3F+DEDoIde2VcrgLk7a/a14uDevPLSVnrOo7zp/ Fppp0FDkitMQ5+JqZxs04UfjE1TIvG9rFx7/O1qR0e04mWp7y2PeiE4ghW9HaVt02wsL WSnb/y3Oq43RmHad62kh19fTZTJzTEkrLVrLJqw2tby2A4pI+yU9SmiAUJ0cKHUINMsb lleF13zmyzOPl8OqcipCQvViBsTs/LBlrAhF6r+KHiqL6vtwgs66RFgYrPuzjDw2R7EX VhFPGEFw1N0Mj54ztbTqYZJrKWJqJiKgz6M+ipDZ1xJskcGD9QvVtnNIjIeAJtfzqh53 3BBg== X-Gm-Message-State: AOAM532H492QR4QuN28yA9fTYY1YoGfT9wOU64vH64MAtT3PsyWHcUWJ mUBaEjuGM5vLX74aWFrHsYlkXtZXqX5kRA== X-Google-Smtp-Source: ABdhPJyCY4pMX5KDnbLHXSX+AzjieeB1bfyqYC6ZVcKQr80N8d2mwo0uPWz2LhfKAg4dG48zDem7wQ== X-Received: by 2002:a05:6000:1d90:: with SMTP id bk16mr9737566wrb.217.1643663201557; Mon, 31 Jan 2022 13:06:41 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b11sm314961wmq.46.2022.01.31.13.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 13:06:41 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 07/21] fbdev/sysfs: Fix locking Date: Mon, 31 Jan 2022 22:05:38 +0100 Message-Id: <20220131210552.482606-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220131210552.482606-1-daniel.vetter@ffwll.ch> References: <20220131210552.482606-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , Intel Graphics Development , LKML , Qing Wang , Daniel Vetter , Sam Ravnborg , Helge Deller Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" fb_set_var requires we hold the fb_info lock. Or at least this now matches what the ioctl does ... Note that ps3fb and sh_mobile_lcdcfb are busted in different ways here, but I will not fix them up. Also in practice this isn't a big deal, because really variable fbdev state is actually protected by console_lock (because fbcon just doesn't bother with lock_fb_info() at all), and lock_fb_info protecting anything is really just a neat lie. But that's a much bigger fish to fry. Signed-off-by: Daniel Vetter Cc: Helge Deller Cc: Daniel Vetter Cc: Qing Wang Cc: Sam Ravnborg --- drivers/video/fbdev/core/fbsysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 26892940c213..8c1ee9ecec3d 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -91,9 +91,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) var->activate |= FB_ACTIVATE_FORCE; console_lock(); + lock_fb_info(fb_info); err = fb_set_var(fb_info, var); if (!err) fbcon_update_vcs(fb_info, var->activate & FB_ACTIVATE_ALL); + unlock_fb_info(fb_info); console_unlock(); if (err) return err; -- 2.33.0 From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94A2CC433EF for ; Mon, 31 Jan 2022 21:06:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C87CA10E4BC; Mon, 31 Jan 2022 21:06:44 +0000 (UTC) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by gabe.freedesktop.org (Postfix) with ESMTPS id F0B2910E492 for ; Mon, 31 Jan 2022 21:06:42 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id f17so27935079wrx.1 for ; Mon, 31 Jan 2022 13:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=XB0If8d+oNzt5EGFOz/pJSfVqwossHreq5Z3/8sGNGT1tWVb8HeX+PuSX4HzuKCtxL 85Ce3vd3TA/uayqURoZ6LVnYYD+zcPj1L3cM6aaDGzt5LCXHqB2YeYKof0DAcvGHjWoE WAj/NXLBP9zyNJqrR3yjJ4zw+CAjDKmq/tKN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gNEcCsAHbmO8BObbR0rzHcF3KU0XqbiUyO0AgqiLr9Q=; b=KWWdARM7BdnP6ZtQVAsgAkzZXXiyROqkYo9RgIiB72BH4oF6UoqwB+lzgZU412uMjE aesObpTG/MWwF7YHaQFweC4Rb2zcbpAGjES8SPMSV3QlBwTXO1AuloTsIjSMbi0cXgdh 9lFEeMfl4l96LmF7tg2XEsUIG9vRafd4Ctu7IHQ07rAIF7KTd6n2QHQ0VADhNK37JNd4 hDVxk+2wjnzg486QqVCn03PY2zTI827h4XnZAyH6IeIuXmOYflBwCTbeTDPgCnnb7+s3 hDNx7pOLFF+l3/BW09WnQJs3imsTSUvVfxS+vLNHkWTyMydYdC3k3Pbe8fEXXVy5Om1B xWGg== X-Gm-Message-State: AOAM532DaKG1abZ8YSRVt1eEEdV/K+wvmGsx9jgPboSnfy85liSllBki hwFTc48b6Fe9dnSvnaztXWGJCw== X-Google-Smtp-Source: ABdhPJyCY4pMX5KDnbLHXSX+AzjieeB1bfyqYC6ZVcKQr80N8d2mwo0uPWz2LhfKAg4dG48zDem7wQ== X-Received: by 2002:a05:6000:1d90:: with SMTP id bk16mr9737566wrb.217.1643663201557; Mon, 31 Jan 2022 13:06:41 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b11sm314961wmq.46.2022.01.31.13.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 13:06:41 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Mon, 31 Jan 2022 22:05:38 +0100 Message-Id: <20220131210552.482606-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220131210552.482606-1-daniel.vetter@ffwll.ch> References: <20220131210552.482606-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Intel-gfx] [PATCH 07/21] fbdev/sysfs: Fix locking X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , Intel Graphics Development , LKML , Qing Wang , Daniel Vetter , Sam Ravnborg , Helge Deller Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" fb_set_var requires we hold the fb_info lock. Or at least this now matches what the ioctl does ... Note that ps3fb and sh_mobile_lcdcfb are busted in different ways here, but I will not fix them up. Also in practice this isn't a big deal, because really variable fbdev state is actually protected by console_lock (because fbcon just doesn't bother with lock_fb_info() at all), and lock_fb_info protecting anything is really just a neat lie. But that's a much bigger fish to fry. Signed-off-by: Daniel Vetter Cc: Helge Deller Cc: Daniel Vetter Cc: Qing Wang Cc: Sam Ravnborg --- drivers/video/fbdev/core/fbsysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 26892940c213..8c1ee9ecec3d 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -91,9 +91,11 @@ static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) var->activate |= FB_ACTIVATE_FORCE; console_lock(); + lock_fb_info(fb_info); err = fb_set_var(fb_info, var); if (!err) fbcon_update_vcs(fb_info, var->activate & FB_ACTIVATE_ALL); + unlock_fb_info(fb_info); console_unlock(); if (err) return err; -- 2.33.0