linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vt: Grab console_lock around con_is_bound in show_bind
@ 2019-07-18  8:09 Daniel Vetter
  2019-07-18 10:37 ` Sam Ravnborg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Vetter @ 2019-07-18  8:09 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: Daniel Vetter, Jens Remus, linux-kernel, dri-devel, linux-fbdev,
	linux-s390, Greg Kroah-Hartman, Nicolas Pitre, Martin Hostettler,
	Adam Borowski, Mikulas Patocka, Daniel Vetter, Sam Ravnborg

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 <jremus@linux.ibm.com>
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 <gregkh@linuxfoundation.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Martin Hostettler <textshell@uchuujin.de>
Cc: Adam Borowski <kilobyte@angband.pl>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 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);
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] vt: Grab console_lock around con_is_bound in show_bind
  2019-07-18  8:09 [PATCH] vt: Grab console_lock around con_is_bound in show_bind Daniel Vetter
@ 2019-07-18 10:37 ` Sam Ravnborg
  2019-07-18 12:02 ` Jens Remus
  2019-07-23  7:38 ` Daniel Vetter
  2 siblings, 0 replies; 5+ messages in thread
From: Sam Ravnborg @ 2019-07-18 10:37 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Intel Graphics Development, Jens Remus, linux-kernel, dri-devel,
	linux-fbdev, linux-s390, Greg Kroah-Hartman, Nicolas Pitre,
	Martin Hostettler, Adam Borowski, Mikulas Patocka, Daniel Vetter

Hi Daniel.

Patch looks good. You can add my:
Acked-by: Sam Ravnborg <sam@ravnborg.org>

For good measure I checked all other users of con_is_bound()
and they looked good from a locking perspective.
Then I looked a bit more for missing locking and lost
the overview.

On Thu, Jul 18, 2019 at 10:09:03AM +0200, Daniel Vetter wrote:
> 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").

Maybe add the warning that Jens reported to the changelog, in case
someone hits something that looks like this warning.
Mainly for google fodder, but also in case changelogs are searched.

	Sam
> 
> Reported-by: Jens Remus <jremus@linux.ibm.com>
> 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 <gregkh@linuxfoundation.org>
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> Cc: Martin Hostettler <textshell@uchuujin.de>
> Cc: Adam Borowski <kilobyte@angband.pl>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  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);
>  }
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vt: Grab console_lock around con_is_bound in show_bind
  2019-07-18  8:09 [PATCH] vt: Grab console_lock around con_is_bound in show_bind Daniel Vetter
  2019-07-18 10:37 ` Sam Ravnborg
@ 2019-07-18 12:02 ` Jens Remus
  2019-07-23  7:38 ` Daniel Vetter
  2 siblings, 0 replies; 5+ messages in thread
From: Jens Remus @ 2019-07-18 12:02 UTC (permalink / raw)
  To: Daniel Vetter, Intel Graphics Development
  Cc: linux-kernel, dri-devel, linux-fbdev, linux-s390,
	Greg Kroah-Hartman, Nicolas Pitre, Martin Hostettler,
	Adam Borowski, Mikulas Patocka, Daniel Vetter, Sam Ravnborg

Am 18.07.2019 um 10:09 schrieb Daniel Vetter:
> 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 <jremus@linux.ibm.com>
> 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 <gregkh@linuxfoundation.org>
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> Cc: Martin Hostettler <textshell@uchuujin.de>
> Cc: Adam Borowski <kilobyte@angband.pl>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>   drivers/tty/vt/vt.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

Thank you for the quick fix! Looks fine to me. Did test with cat as well 
as our dump2tar utility. The warning is gone.

Tested-by: Jens Remus <jremus@linux.ibm.com>

Regards,
Jens Remus
-- 
Linux on Z and z/VSE Development & Service (D3229)
IBM Systems & Technology Group, Pure Systems & Modular Software Development

IBM Data Privacy Statement: https://www.ibm.com/privacy/us/en/

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vt: Grab console_lock around con_is_bound in show_bind
  2019-07-18  8:09 [PATCH] vt: Grab console_lock around con_is_bound in show_bind Daniel Vetter
  2019-07-18 10:37 ` Sam Ravnborg
  2019-07-18 12:02 ` Jens Remus
@ 2019-07-23  7:38 ` Daniel Vetter
  2019-07-23  7:55   ` Greg Kroah-Hartman
  2 siblings, 1 reply; 5+ messages in thread
From: Daniel Vetter @ 2019-07-23  7:38 UTC (permalink / raw)
  To: Intel Graphics Development
  Cc: Daniel Vetter, Jens Remus, linux-kernel, dri-devel, linux-fbdev,
	linux-s390, Greg Kroah-Hartman, Nicolas Pitre, Martin Hostettler,
	Adam Borowski, Mikulas Patocka, Daniel Vetter, Sam Ravnborg

Hi Greg,

Do you plan to pick this up in your console/vt/whatever-fixes branch?
There's no reason for me to route this through drm-fixes.
-Daniel

On Thu, Jul 18, 2019 at 10:09:03AM +0200, Daniel Vetter wrote:
> 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 <jremus@linux.ibm.com>
> 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 <gregkh@linuxfoundation.org>
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> Cc: Martin Hostettler <textshell@uchuujin.de>
> Cc: Adam Borowski <kilobyte@angband.pl>
> Cc: Mikulas Patocka <mpatocka@redhat.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> ---
>  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);
>  }
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] vt: Grab console_lock around con_is_bound in show_bind
  2019-07-23  7:38 ` Daniel Vetter
@ 2019-07-23  7:55   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2019-07-23  7:55 UTC (permalink / raw)
  To: Intel Graphics Development, Jens Remus, linux-kernel, dri-devel,
	linux-fbdev, linux-s390, Nicolas Pitre, Martin Hostettler,
	Adam Borowski, Mikulas Patocka, Daniel Vetter, Sam Ravnborg

On Tue, Jul 23, 2019 at 09:38:20AM +0200, Daniel Vetter wrote:
> Hi Greg,
> 
> Do you plan to pick this up in your console/vt/whatever-fixes branch?

Yes, now that the merge window is closed, I will be picking this up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-23  7:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18  8:09 [PATCH] vt: Grab console_lock around con_is_bound in show_bind Daniel Vetter
2019-07-18 10:37 ` Sam Ravnborg
2019-07-18 12:02 ` Jens Remus
2019-07-23  7:38 ` Daniel Vetter
2019-07-23  7:55   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).