OSDN Git Service

linux sysfs: Fix read-write access in map_legacy
authorJeremy Huddleston <jeremyhu@apple.com>
Tue, 11 Oct 2011 17:22:49 +0000 (10:22 -0700)
committerJeremy Huddleston <jeremyhu@apple.com>
Tue, 11 Oct 2011 17:22:49 +0000 (10:22 -0700)
O_RDONLY | O_WRONLY != O_RDWR

><

Reported-by: Javier Pello <javier.pello@urjc.es>
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
src/linux_sysfs.c

index 876abb1..d5ba66a 100644 (file)
@@ -851,7 +851,7 @@ pci_device_linux_sysfs_map_legacy(struct pci_device *dev, pciaddr_t base,
     int ret=0;
 
     if (map_flags & PCI_DEV_MAP_FLAG_WRITABLE) {
-       flags |= O_WRONLY;
+       flags = O_RDWR; /* O_RDWR != O_WRONLY | O_RDONLY */;
        prot |= PROT_WRITE;
     }