add upstream fix to fix X crash on OLPC XO-1.5
This commit is contained in:
parent
137f6c5b50
commit
dd52719b75
48
libpciaccess-ios-free.patch
Normal file
48
libpciaccess-ios-free.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
From a798395a1bfd9d06d40e2d8d14377a156c94429a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Drake <dsd@laptop.org>
|
||||||
|
Date: Fri, 25 Nov 2011 12:28:48 -0600
|
||||||
|
Subject: [PATCH] delete_io_handle: fix deletion of last handle
|
||||||
|
|
||||||
|
When num_ios goes from 1 to 0, a realloc(ios, 0); call is made.
|
||||||
|
This is equivalent to free(ios) and NULL is returned.
|
||||||
|
|
||||||
|
However, the previous logic in the code incorrectly discards this NULL
|
||||||
|
return value. When we next call new_io_handle(), realloc(ios, X) is
|
||||||
|
called with "ios" pointing to freed memory. This causes glibc to abort.
|
||||||
|
|
||||||
|
Correct this logic to detect the 1-to-0 case and handle it correctly.
|
||||||
|
Other cases are unchanged; there is still value in checking the
|
||||||
|
return value from realloc() as it also returns NULL on error.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Drake <dsd@laptop.org>
|
||||||
|
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||||
|
---
|
||||||
|
src/common_io.c | 11 ++++++++---
|
||||||
|
1 files changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/common_io.c b/src/common_io.c
|
||||||
|
index f1319f8..5b35e07 100644
|
||||||
|
--- a/src/common_io.c
|
||||||
|
+++ b/src/common_io.c
|
||||||
|
@@ -64,10 +64,15 @@ delete_io_handle(struct pci_io_handle *handle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- new = realloc(ios, sizeof(struct pci_io_handle) * (num_ios - 1));
|
||||||
|
- if (new)
|
||||||
|
- ios = new;
|
||||||
|
num_ios--;
|
||||||
|
+ if (num_ios) {
|
||||||
|
+ new = realloc(ios, sizeof(struct pci_io_handle) * num_ios);
|
||||||
|
+ if (new)
|
||||||
|
+ ios = new;
|
||||||
|
+ } else {
|
||||||
|
+ free(ios);
|
||||||
|
+ ios = NULL;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
_pci_hidden void
|
||||||
|
--
|
||||||
|
1.7.7.3
|
||||||
|
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: libpciaccess
|
Name: libpciaccess
|
||||||
Version: 0.12.902
|
Version: 0.12.902
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: PCI access library
|
Summary: PCI access library
|
||||||
|
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
@ -18,6 +18,7 @@ Source1: make-libpciaccess-snapshot.sh
|
|||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
Patch2: libpciaccess-rom-size.patch
|
Patch2: libpciaccess-rom-size.patch
|
||||||
|
Patch3: libpciaccess-ios-free.patch
|
||||||
|
|
||||||
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
|
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
|
||||||
Requires: hwdata
|
Requires: hwdata
|
||||||
@ -38,6 +39,7 @@ Development package for libpciaccess.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
|
%setup -q -n %{name}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
|
||||||
%patch2 -p1 -b .rom-size
|
%patch2 -p1 -b .rom-size
|
||||||
|
%patch3 -p1 -b .ios
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoreconf -v --install
|
autoreconf -v --install
|
||||||
@ -68,6 +70,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_libdir}/pkgconfig/pciaccess.pc
|
%{_libdir}/pkgconfig/pciaccess.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 28 2011 Daniel Drake <dsd@laptop.org> 0.12.902-2
|
||||||
|
- Add upstream patch to fix ios deletion; fixes X crash on OLPC XO-1.5
|
||||||
|
|
||||||
* Wed Nov 09 2011 Adam Jackson <ajax@redhat.com> 0.12.902-1
|
* Wed Nov 09 2011 Adam Jackson <ajax@redhat.com> 0.12.902-1
|
||||||
- libpciaccess 0.12.902
|
- libpciaccess 0.12.902
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user