[oe-commits] Martin Jansa : libpciaccesss: segfault fix from git master

git version control git at git.openembedded.org
Fri Sep 25 08:22:34 UTC 2009


Module: openembedded.git
Branch: shr/import
Commit: 8cb1e1121d1621c8fc9117d5a35368947f7c7223
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=8cb1e1121d1621c8fc9117d5a35368947f7c7223

Author: Martin Jansa <martin.jansa at gmail.com>
Date:   Thu Sep 24 15:50:29 2009 +0000

libpciaccesss: segfault fix from git master

Signed-off-by: Klaus Kurzmann <mok at fluxnetz.de>

---

 ...eck-pci_sys-exists-before-initing-vga-arb.patch |    4 +-
 ...-value-from-scandir-instead-of-leaking-it.patch |   31 ++++++++++++++++++++
 .../0003-vgaarb-check-for-fd-before-close-it.patch |   30 +++++++++++++++++++
 .../libpciaccess/0004-vgaarb-fix-newbie-typo.patch |   29 ++++++++++++++++++
 recipes/xorg-lib/libpciaccess_0.10.8.bb            |   10 ++++++-
 5 files changed, 101 insertions(+), 3 deletions(-)

diff --git a/recipes/xorg-lib/libpciaccess/0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch b/recipes/xorg-lib/libpciaccess/0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch
index 74cf352..6b86bd9 100644
--- a/recipes/xorg-lib/libpciaccess/0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch
+++ b/recipes/xorg-lib/libpciaccess/0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch
@@ -1,7 +1,7 @@
 From 42b879a203c1c16daa9d0c610c6a217ead7a5829 Mon Sep 17 00:00:00 2001
 From: Dave Airlie <airlied at linux.ie>
 Date: Wed, 2 Sep 2009 19:03:11 +1000
-Subject: [PATCH] vgaarb: check pci_sys exists before initing vga arb
+Subject: [PATCH 1/4] vgaarb: check pci_sys exists before initing vga arb
 
 ---
  src/common_vgaarb.c |    4 ++++
@@ -23,5 +23,5 @@ index a40b064..ca5c0a7 100644
          return errno;
      }
 -- 
-1.6.4.2
+1.6.5.rc1
 
diff --git a/recipes/xorg-lib/libpciaccess/0002-Free-return-value-from-scandir-instead-of-leaking-it.patch b/recipes/xorg-lib/libpciaccess/0002-Free-return-value-from-scandir-instead-of-leaking-it.patch
new file mode 100644
index 0000000..9ccb065
--- /dev/null
+++ b/recipes/xorg-lib/libpciaccess/0002-Free-return-value-from-scandir-instead-of-leaking-it.patch
@@ -0,0 +1,31 @@
+From cdbdfaf61c05d0d18eae6815b10666f93162148f Mon Sep 17 00:00:00 2001
+From: Keith Packard <keithp at keithp.com>
+Date: Thu, 17 Sep 2009 17:38:56 -0700
+Subject: [PATCH 2/4] Free return value from scandir instead of leaking it.
+
+Scandir is defined to return pointers to malloc'd storage, so make
+sure that memory is nicely freed.
+
+Signed-off-by: Keith Packard <keithp at keithp.com>
+---
+ src/linux_sysfs.c |    4 ++++
+ 1 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
+index 02fbd13..85095b3 100644
+--- a/src/linux_sysfs.c
++++ b/src/linux_sysfs.c
+@@ -213,6 +213,10 @@ populate_entries( struct pci_system * p )
+ 	}
+     }
+ 
++    for (i = 0; i < n; i++)
++	free(devices[i]);
++    free(devices);
++
+     if (err) {
+ 	free(p->devices);
+ 	p->devices = NULL;
+-- 
+1.6.5.rc1
+
diff --git a/recipes/xorg-lib/libpciaccess/0003-vgaarb-check-for-fd-before-close-it.patch b/recipes/xorg-lib/libpciaccess/0003-vgaarb-check-for-fd-before-close-it.patch
new file mode 100644
index 0000000..4a5754e
--- /dev/null
+++ b/recipes/xorg-lib/libpciaccess/0003-vgaarb-check-for-fd-before-close-it.patch
@@ -0,0 +1,30 @@
+From 13c7e6c8f100882718f995f5bf1d478a012cdbdd Mon Sep 17 00:00:00 2001
+From: Tiago Vignatti <tiago.vignatti at nokia.com>
+Date: Wed, 16 Sep 2009 12:56:53 +0300
+Subject: [PATCH 3/4] vgaarb: check for fd before close it
+
+Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
+---
+ src/common_vgaarb.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c
+index ca5c0a7..f1c71e0 100644
+--- a/src/common_vgaarb.c
++++ b/src/common_vgaarb.c
+@@ -150,6 +150,12 @@ pci_device_vgaarb_init(void)
+ void
+ pci_device_vgaarb_fini(void)
+ {
++    if (!pci_sys)
++        return;
++
++    if (!pci_sys->vgaarb_fd)
++        return;
++
+     close(pci_sys->vgaarb_fd);
+ }
+ 
+-- 
+1.6.5.rc1
+
diff --git a/recipes/xorg-lib/libpciaccess/0004-vgaarb-fix-newbie-typo.patch b/recipes/xorg-lib/libpciaccess/0004-vgaarb-fix-newbie-typo.patch
new file mode 100644
index 0000000..79ae16f
--- /dev/null
+++ b/recipes/xorg-lib/libpciaccess/0004-vgaarb-fix-newbie-typo.patch
@@ -0,0 +1,29 @@
+From 1714046ef08ef685bcf1d6c154e64809b12e8d7f Mon Sep 17 00:00:00 2001
+From: Tiago Vignatti <tiago.vignatti at nokia.com>
+Date: Fri, 18 Sep 2009 15:21:19 +0300
+Subject: [PATCH 4/4] vgaarb: fix newbie typo
+
+Eh, we don't need to check for the fd anyway. Kudos jcristau for reporting.
+
+Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
+---
+ src/common_vgaarb.c |    3 ---
+ 1 files changed, 0 insertions(+), 3 deletions(-)
+
+diff --git a/src/common_vgaarb.c b/src/common_vgaarb.c
+index f1c71e0..6358a66 100644
+--- a/src/common_vgaarb.c
++++ b/src/common_vgaarb.c
+@@ -153,9 +153,6 @@ pci_device_vgaarb_fini(void)
+     if (!pci_sys)
+         return;
+ 
+-    if (!pci_sys->vgaarb_fd)
+-        return;
+-
+     close(pci_sys->vgaarb_fd);
+ }
+ 
+-- 
+1.6.5.rc1
+
diff --git a/recipes/xorg-lib/libpciaccess_0.10.8.bb b/recipes/xorg-lib/libpciaccess_0.10.8.bb
index e60e196..dffa323 100644
--- a/recipes/xorg-lib/libpciaccess_0.10.8.bb
+++ b/recipes/xorg-lib/libpciaccess_0.10.8.bb
@@ -2,4 +2,12 @@ require xorg-lib-common.inc
 
 DEPENDS += "xproto virtual/libx11"
 
-SRC_URI += "file://0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch;patch=1"
+PR="r1"
+
+SRC_URI += "\
+            file://0001-vgaarb-check-pci_sys-exists-before-initing-vga-arb.patch;patch=1 \
+            file://0002-Free-return-value-from-scandir-instead-of-leaking-it.patch;patch=1 \
+            file://0003-vgaarb-check-for-fd-before-close-it.patch;patch=1 \
+            file://0004-vgaarb-fix-newbie-typo.patch;patch=1 \
+           "
+





More information about the Openembedded-commits mailing list