mmap : check the return code of dev_dmmap_single
authorJoris Giovannangeli <joris@giovannangeli.fr>
Mon, 24 Feb 2014 20:39:39 +0000 (21:39 +0100)
committerJoris Giovannangeli <joris@giovannangeli.fr>
Mon, 24 Feb 2014 20:47:18 +0000 (21:47 +0100)
drm might return other codes than ENODEV. We want to fail in this
case too. This fix a path where object might be left uninitialized.

sys/vm/vm_mmap.c

index 393e98a..c52a9c3 100644 (file)
@@ -1321,7 +1321,11 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t size, vm_prot_t prot,
                                        lwkt_reltoken(&map->token);
                                        return(EINVAL);
                                }
+                       } else if (error) {
+                               lwkt_reltoken(&map->token);
+                               return(error);
                        }
+
                        docow = MAP_PREFAULT_PARTIAL;
                        flags &= ~(MAP_PRIVATE|MAP_COPY);
                        flags |= MAP_SHARED;