rpms/libpciaccess/devel libpciaccess-0.10.6-rom-sanity.patch, NONE, 1.1 libpciaccess.spec, 1.23, 1.24
Adam Jackson
ajax at fedoraproject.org
Wed Aug 5 15:52:45 UTC 2009
Author: ajax
Update of /cvs/pkgs/rpms/libpciaccess/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29062
Modified Files:
libpciaccess.spec
Added Files:
libpciaccess-0.10.6-rom-sanity.patch
Log Message:
* Wed Aug 05 2009 Adam Jackson <ajax at redhat.com> 0.10.6-5
- libpciaccess-0.10.6-rom-sanity.patch: If we hit the /dev/mem path for
reading a device's ROM, verify that it looks like it at least might belong
to the device in question by checking vendor and device ID match. Fixes
vbetool post hanging forever (and thus blocking boot) on some dual-gpu
laptops.
libpciaccess-0.10.6-rom-sanity.patch:
linux_devmem.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
--- NEW FILE libpciaccess-0.10.6-rom-sanity.patch ---
diff -up libpciaccess-0.10.6/src/linux_devmem.c.jx libpciaccess-0.10.6/src/linux_devmem.c
--- libpciaccess-0.10.6/src/linux_devmem.c.jx 2008-10-15 18:35:54.000000000 -0400
+++ libpciaccess-0.10.6/src/linux_devmem.c 2009-08-05 11:43:14.000000000 -0400
@@ -50,6 +50,30 @@
#include "pciaccess_private.h"
#include "linux_devmem.h"
+static int
+rom_sanity_check(struct pci_device *info, void *buffer)
+{
+ unsigned char *bios = buffer;
+ int offset;
+ unsigned short vendor, device;
+
+ if (bios[0] != 0x55 || bios[1] != 0xAA)
+ return 0;
+
+ offset = (bios[0x19] << 8) + bios[0x18];
+
+ if (bios[offset] != 'P' ||
+ bios[offset+1] != 'C' ||
+ bios[offset+2] != 'I' ||
+ bios[offset+3] != 'R')
+ return 0;
+
+ vendor = (bios[offset+5] << 8) + bios[offset+4];
+ device = (bios[offset+7] << 8) + bios[offset+6];
+
+ return (info->vendor_id == vendor) && (info->device_id == device);
+}
+
/**
* Read a device's expansion ROM using /dev/mem.
*
@@ -152,5 +176,5 @@ pci_device_linux_devmem_read_rom(struct
}
}
- return err;
+ return rom_sanity_check(dev, buffer);
}
Index: libpciaccess.spec
===================================================================
RCS file: /cvs/pkgs/rpms/libpciaccess/devel/libpciaccess.spec,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -p -r1.23 -r1.24
--- libpciaccess.spec 3 Aug 2009 00:00:31 -0000 1.23
+++ libpciaccess.spec 5 Aug 2009 15:52:45 -0000 1.24
@@ -3,7 +3,7 @@
Name: libpciaccess
Version: 0.10.6
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: PCI access library
Group: System Environment/Libraries
@@ -21,6 +21,7 @@ Patch0: libpciaccess-fd-cache.patch
Patch2: libpciaccess-rom-size.patch
Patch3: libpciaccess-boot-vga.patch
Patch4: libpciaccess-vga-arbiter.patch
+Patch5: libpciaccess-0.10.6-rom-sanity.patch
BuildRequires: autoconf automake libtool pkgconfig xorg-x11-util-macros
Requires: hwdata
@@ -44,6 +45,7 @@ Development package for libpciaccess.
%patch2 -p1 -b .rom-size
%patch3 -p1 -b .bootvga
%patch4 -p1 -b .vgaarb
+%patch5 -p1 -b .jx
%build
autoreconf -v --install
@@ -74,6 +76,13 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/pciaccess.pc
%changelog
+* Wed Aug 05 2009 Adam Jackson <ajax at redhat.com> 0.10.6-5
+- libpciaccess-0.10.6-rom-sanity.patch: If we hit the /dev/mem path for
+ reading a device's ROM, verify that it looks like it at least might belong
+ to the device in question by checking vendor and device ID match. Fixes
+ vbetool post hanging forever (and thus blocking boot) on some dual-gpu
+ laptops.
+
* Mon Aug 03 2009 Dave Airlie <airlied at redhat.com> 0.10.6-4
- Add support for default vga arb device selection
- Update libpciaccess VGA arb code for newer kernel API
More information about the fedora-extras-commits
mailing list