]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Check the sync operation.
authormarcel <marcel@FreeBSD.org>
Tue, 28 Jul 2015 04:54:05 +0000 (04:54 +0000)
committermarcel <marcel@FreeBSD.org>
Tue, 28 Jul 2015 04:54:05 +0000 (04:54 +0000)
sys/dev/proto/proto_busdma.c

index 52f1146ffdd017d1a8cc9c6d407dc492eddd85a5..6f6bf7b0891600a9bdba888e061932d3fa0df883 100644 (file)
@@ -325,7 +325,12 @@ static int
 proto_busdma_sync(struct proto_busdma *busdma, struct proto_md *md,
     struct proto_ioc_busdma *ioc)
 {
+       u_int ops;
+
+       ops = BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE |
+           BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE;
+       if (ioc->u.sync.op & ~ops)
+               return (EINVAL);
        if (!md->physaddr)
                return (ENXIO);
        bus_dmamap_sync(md->bd_tag, md->bd_map, ioc->u.sync.op);