Author: skra
Date: Sun Nov  8 18:48:35 2015
New Revision: 290553
URL: https://svnweb.freebsd.org/changeset/base/290553

Log:
  Fix pagelist bus_dmamap_t map handling. Memory for pagelist is allocated
  by bus_dmamem_alloc() which creates associated bus_dmamap_t map for us.
  When this memory is freed by bus_dmamem_free(), the map is freed as well.
  
  Thus there is no need to free it explicitly by bus_dmamap_destroy(),
  which leads to double freeing.
  
  Discussed with:       gonzo
  Approved by:  kib (mentor)

Modified:
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c
==============================================================================
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Sun Nov  8 
18:11:24 2015        (r290552)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c Sun Nov  8 
18:48:35 2015        (r290553)
@@ -542,9 +542,8 @@ create_pagelist(char __user *buf, size_t
        return 0;
 
 failed_load:
-       bus_dmamap_unload(bi->pagelist_dma_tag, bi->pagelist_dma_map);
+       bus_dmamem_free(bi->pagelist_dma_tag, bi->pagelist, 
bi->pagelist_dma_map);
 failed_alloc:
-       bus_dmamap_destroy(bi->pagelist_dma_tag, bi->pagelist_dma_map);
        bus_dma_tag_destroy(bi->pagelist_dma_tag);
 
        return err;
@@ -613,7 +612,6 @@ free_pagelist(BULKINFO_T *bi, int actual
 
        bus_dmamap_unload(bi->pagelist_dma_tag, bi->pagelist_dma_map);
        bus_dmamem_free(bi->pagelist_dma_tag, bi->pagelist, 
bi->pagelist_dma_map);
-       bus_dmamap_destroy(bi->pagelist_dma_tag, bi->pagelist_dma_map);
        bus_dma_tag_destroy(bi->pagelist_dma_tag);
 
        free(bi, M_VCPAGELIST);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to