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: 11048647 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 96D28112C for ; Thu, 18 Jul 2019 08:09:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8413A2878F for ; Thu, 18 Jul 2019 08:09:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 751AE287CF; Thu, 18 Jul 2019 08:09:15 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA03D2878F for ; Thu, 18 Jul 2019 08:09:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727641AbfGRIJO (ORCPT ); Thu, 18 Jul 2019 04:09:14 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37780 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfGRIJN (ORCPT ); Thu, 18 Jul 2019 04:09:13 -0400 Received: by mail-ed1-f66.google.com with SMTP id w13so29360780eds.4 for ; Thu, 18 Jul 2019 01:09:12 -0700 (PDT) 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-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=LjdQ8S7fjLmJA49iCBO53ETalkEMhVofoQsgpM6P9e2ngr1FzAVtap6u3Aolp2kXh7 C25OFCP7FF1cN5Gn3hA3WvrHgNLu7YtVpBFOd82O/arw/SqlqUAgNJGiLrsUv79FkbIr D33OnLYeiCr4ArsFph35PxC0T+u0SdOCrEQSiPzYuSnD3NbTmfxYol0yARiztwOB0XnR c8YTFo+r6UYAG12cXoOGigtHGri/hwFwBrnvOi+oymsbo5Jk8ZxQOt4QsBECFsM3UrAm 4RaP6NOlvI4pIfaSex7+ZJzGxOGvi5RzIo29buXBHXNykOGl2VB92vLZoegzaQ7er+8U NXCA== X-Gm-Message-State: APjAAAUq8T/vIXHfzm0OGyQHK8/LaQoYpWVjAkvqXcCR4ixOKnQSO9CR Hpl+1gZPzIDQvmkXX929CHAVa3bH 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 Cc: Daniel Vetter , Jens Remus , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-s390@vger.kernel.org, Greg Kroah-Hartman , Nicolas Pitre , Martin Hostettler , Adam Borowski , Mikulas Patocka , Daniel Vetter , Sam Ravnborg 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 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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); }