2010-01-12 18:13:38

by Tiago Vignatti

[permalink] [raw]
Subject: [PATCH] vgaarb: fix typo deference when copying from userspace

From: Brad Spengler <[email protected]>

libpciaccess is not triggering such code though.

Signed-off-by: Tiago Vignatti <[email protected]>
---
Andy Getzendanner tried to fix this, but he seems did a wrong approach:
http://marc.info/?l=linux-kernel&m=126112173704466

Andy: please test (and put your tag review!) this one instead. Thanks.

drivers/gpu/vga/vgaarb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 1ac0c93..2f6cf69 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -961,7 +961,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
remaining -= 7;
pr_devel("client 0x%p called 'target'\n", priv);
/* if target is default */
- if (!strncmp(buf, "default", 7))
+ if (!strncmp(curr_pos, "default", 7))
pdev = pci_dev_get(vga_default_device());
else {
if (!vga_pci_str_to_vars(curr_pos, remaining,
--
1.6.0.4


2010-01-12 18:13:40

by Tiago Vignatti

[permalink] [raw]
Subject: [PATCH] vgaarb: fix trylock behaviour accordingly vga_tryget return value

From: Henry Zhao <[email protected]>

Signed-off-by: Tiago Vignatti <[email protected]>
---
Henry, can you Signed-off-by there?

drivers/gpu/vga/vgaarb.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 2f6cf69..0f5f64d 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -935,7 +935,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
goto done;
}

- if (vga_tryget(pdev, io_state)) {
+ if (!vga_tryget(pdev, io_state)) {
/* Update the client's locks lists... */
for (i = 0; i < MAX_USER_CARDS; i++) {
if (priv->cards[i].pdev == pdev) {
--
1.6.0.4

2010-01-12 18:13:54

by Tiago Vignatti

[permalink] [raw]
Subject: [PATCH-again] vgaarb: use MIT license

Signed-off-by: Tiago Vignatti <[email protected]>
---
Hi. All authors already decided about such change. So I'd please ask (again)
that you put the s-o-b tag here. Thanks.

drivers/gpu/vga/vgaarb.c | 26 +++++++++++++++++++++++---
include/linux/vgaarb.h | 21 +++++++++++++++++++++
2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 0f5f64d..53dd628 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -1,12 +1,32 @@
/*
- * vgaarb.c
+ * vgaarb.c: Implements the VGA arbitration. For details refer to
+ * Documentation/vgaarbiter.txt
+ *
*
* (C) Copyright 2005 Benjamin Herrenschmidt <[email protected]>
* (C) Copyright 2007 Paulo R. Zanoni <[email protected]>
* (C) Copyright 2007, 2009 Tiago Vignatti <[email protected]>
*
- * Implements the VGA arbitration. For details refer to
- * Documentation/vgaarbiter.txt
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS
+ * IN THE SOFTWARE.
+ *
*/

#include <linux/module.h>
diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
index 2dfaa29..c9a9759 100644
--- a/include/linux/vgaarb.h
+++ b/include/linux/vgaarb.h
@@ -5,6 +5,27 @@
* (C) Copyright 2005 Benjamin Herrenschmidt <[email protected]>
* (C) Copyright 2007 Paulo R. Zanoni <[email protected]>
* (C) Copyright 2007, 2009 Tiago Vignatti <[email protected]>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS
+ * IN THE SOFTWARE.
+ *
*/

#ifndef LINUX_VGA_H
--
1.6.0.4

2010-01-12 18:56:45

by Helge Deller

[permalink] [raw]
Subject: Re: [PATCH] vgaarb: fix typo deference when copying from userspace

On 01/12/2010 06:58 PM, Tiago Vignatti wrote:
> From: Brad Spengler<[email protected]>
>
> libpciaccess is not triggering such code though.
>
> Signed-off-by: Tiago Vignatti<[email protected]>

I can confirm, that this patch is needed to prevent a kernel
segfault with 2.6.33-rc3 on the parisc/hppa architecture.

Tested-by: Helge Deller <[email protected]>

> ---
> Andy Getzendanner tried to fix this, but he seems did a wrong approach:
> http://marc.info/?l=linux-kernel&m=126112173704466
>
> Andy: please test (and put your tag review!) this one instead. Thanks.
>
> drivers/gpu/vga/vgaarb.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
> index 1ac0c93..2f6cf69 100644
> --- a/drivers/gpu/vga/vgaarb.c
> +++ b/drivers/gpu/vga/vgaarb.c
> @@ -961,7 +961,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
> remaining -= 7;
> pr_devel("client 0x%p called 'target'\n", priv);
> /* if target is default */
> - if (!strncmp(buf, "default", 7))
> + if (!strncmp(curr_pos, "default", 7))
> pdev = pci_dev_get(vga_default_device());
> else {
> if (!vga_pci_str_to_vars(curr_pos, remaining,

2010-01-13 04:05:32

by Henry Zhao

[permalink] [raw]
Subject: Re: [PATCH] vgaarb: fix trylock behaviour accordingly vga_tryget return value

Signed-off-by: Henry Zhao <[email protected]>

Tiago Vignatti wrote:
> From: Henry Zhao <[email protected]>
>
> Signed-off-by: Tiago Vignatti <[email protected]>
> ---
> Henry, can you Signed-off-by there?
>
> drivers/gpu/vga/vgaarb.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
> index 2f6cf69..0f5f64d 100644
> --- a/drivers/gpu/vga/vgaarb.c
> +++ b/drivers/gpu/vga/vgaarb.c
> @@ -935,7 +935,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user * buf,
> goto done;
> }
>
> - if (vga_tryget(pdev, io_state)) {
> + if (!vga_tryget(pdev, io_state)) {
> /* Update the client's locks lists... */
> for (i = 0; i < MAX_USER_CARDS; i++) {
> if (priv->cards[i].pdev == pdev) {
>

2010-01-14 15:07:38

by Paulo Zanoni

[permalink] [raw]
Subject: Re: [PATCH-again] vgaarb: use MIT license

On Tue, Jan 12, 2010 at 3:58 PM, Tiago Vignatti
<[email protected]> wrote:
> Signed-off-by: Tiago Vignatti <[email protected]>
Signed-off-by: Paulo R. Zanoni <[email protected]>

> ---
> Hi. All authors already decided about such change. So I'd please ask (again)
> that you put the s-o-b tag here. Thanks.
>
> ?drivers/gpu/vga/vgaarb.c | ? 26 +++++++++++++++++++++++---
> ?include/linux/vgaarb.h ? | ? 21 +++++++++++++++++++++
> ?2 files changed, 44 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
> index 0f5f64d..53dd628 100644
> --- a/drivers/gpu/vga/vgaarb.c
> +++ b/drivers/gpu/vga/vgaarb.c
> @@ -1,12 +1,32 @@
> ?/*
> - * vgaarb.c
> + * vgaarb.c: Implements the VGA arbitration. For details refer to
> + * Documentation/vgaarbiter.txt
> + *
> ?*
> ?* (C) Copyright 2005 Benjamin Herrenschmidt <[email protected]>
> ?* (C) Copyright 2007 Paulo R. Zanoni <[email protected]>
> ?* (C) Copyright 2007, 2009 Tiago Vignatti <[email protected]>
> ?*
> - * Implements the VGA arbitration. For details refer to
> - * Documentation/vgaarbiter.txt
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ?IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS
> + * IN THE SOFTWARE.
> + *
> ?*/
>
> ?#include <linux/module.h>
> diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h
> index 2dfaa29..c9a9759 100644
> --- a/include/linux/vgaarb.h
> +++ b/include/linux/vgaarb.h
> @@ -5,6 +5,27 @@
> ?* (C) Copyright 2005 Benjamin Herrenschmidt <[email protected]>
> ?* (C) Copyright 2007 Paulo R. Zanoni <[email protected]>
> ?* (C) Copyright 2007, 2009 Tiago Vignatti <[email protected]>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ?IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS
> + * IN THE SOFTWARE.
> + *
> ?*/
>
> ?#ifndef LINUX_VGA_H
> --
> 1.6.0.4
>
>



--
Paulo R. Zanoni