From patchwork Thu Jul 18 08:09:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11048649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E4A3912 for ; Thu, 18 Jul 2019 08:09:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F88C2878F for ; Thu, 18 Jul 2019 08:09:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51A98287CF; Thu, 18 Jul 2019 08:09:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DCCB92878F for ; Thu, 18 Jul 2019 08:09:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E22616E342; Thu, 18 Jul 2019 08:09:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5AA36E343 for ; Thu, 18 Jul 2019 08:09:14 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id k21so29375022edq.3 for ; Thu, 18 Jul 2019 01:09:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+Iyfr5/1NYNdQhpDWPT06wuP/cAAoXegst7lt2IsF58=; b=NTTFQpU/JzIknQK0lP6KbrqKKKsHePb40zrcRlG2GB1Ff6QqZMV5ud8kJL5ApNbLY7 Hxy6i0cEjP3+GTbXa/CfX9HCRQHoxcbZ3GvytxrV2imWQOmubZUzJYMNY9qaFcQqeaGc mr1h6TJ5fnPlMe6/qYC2PLPIgc2Ve4pBeg03rOiuDnBGBDThpfbe1fFeO1yUH56/RFKN yHXM9mnrH5k4bP7+OUUIXU1QQLE8a87oiEwmtsVitffZDwV6nzghsLS+K9lA1PeDexjy MfodylnpW0dZjpYQDxU3WlskzEnqsE1UcAfhcIZT2vQsTPeDRG0+oUuXludQxlZyzc0y 52pQ== X-Gm-Message-State: APjAAAUwOD04ORLEbP1mzi2GK1IDFcgtL2kRc/rKICFRRusGCQ0KWk1C V0WbZiWrFC9bQGQw7OWexO0= X-Google-Smtp-Source: APXvYqykBiX6Jo5Tfwh9csgIjcDSqs9NfSDZzAEw+X4to7YWwbULxI67P9uCx6KZm68g1spWwShXGQ== X-Received: by 2002:a17:906:6582:: with SMTP id x2mr12620386ejn.2.1563437352239; Thu, 18 Jul 2019 01:09:12 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id l38sm7608440eda.1.2019.07.18.01.09.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 18 Jul 2019 01:09:11 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Subject: [PATCH] vt: Grab console_lock around con_is_bound in show_bind Date: Thu, 18 Jul 2019 10:09:03 +0200 Message-Id: <20190718080903.22622-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+Iyfr5/1NYNdQhpDWPT06wuP/cAAoXegst7lt2IsF58=; b=Z7bNK0nfFW0N6BAI/rd5EED657okw9jUljgqrouABquv5zutt1fVG9cnzovdPvciis KmFVJJy3QcvbNE2hG6hzs11SjCaCGvNXExkjBAoy7FPPfdiQgzM2w8/Q6zsSmyUaMgdt r+fACRtZtYBPe+sS/se1+IEvfwhP/fSaBENKo= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nicolas Pitre , linux-s390@vger.kernel.org, linux-fbdev@vger.kernel.org, Adam Borowski , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Martin Hostettler , Mikulas Patocka , Greg Kroah-Hartman , Daniel Vetter , Sam Ravnborg , Jens Remus Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Not really harmful not to, but also not harm in grabbing the lock. And this shuts up a new WARNING I introduced in commit ddde3c18b700 ("vt: More locking checks"). Reported-by: Jens Remus Cc: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Martin Hostettler Cc: Adam Borowski Cc: Mikulas Patocka Signed-off-by: Daniel Vetter Cc: Daniel Vetter Cc: Sam Ravnborg Acked-by: Sam Ravnborg Tested-by: Jens Remus --- drivers/tty/vt/vt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index ec92f36ab5c4..34aa39d1aed9 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3771,7 +3771,11 @@ static ssize_t show_bind(struct device *dev, struct device_attribute *attr, char *buf) { struct con_driver *con = dev_get_drvdata(dev); - int bind = con_is_bound(con->con); + int bind; + + console_lock(); + bind = con_is_bound(con->con); + console_unlock(); return snprintf(buf, PAGE_SIZE, "%i\n", bind); }