1. 03 Jan, 2012 1 commit
    • Julia Lawall's avatar
      xen-gntalloc: introduce missing kfree · 2e163414
      Julia Lawall authored
      Error handling code following a kmalloc should free the allocated data.
      Out_unlock is used on both success and failure, so free vm_priv before
      jumping to that label.
      A simplified version of the semantic match that finds the problem is as
      follows: (http://coccinelle.lip6.fr)
      // <smpl>
      @r exists@
      local idexpression x;
      statement S;
      identifier f1;
      position p1,p2;
      expression *ptr != NULL;
      x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
      if (x == NULL) S
      <... when != x
           when != if (...) { <+...x...+> }
       return \(0\|<+...x...+>\|ptr\);
       return@p2 ...;
      p1 << r.p1;
      p2 << r.p2;
      print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      [v1: Altered the description a bit]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  2. 16 Dec, 2011 2 commits
  3. 21 Nov, 2011 2 commits
  4. 16 Nov, 2011 2 commits
  5. 10 Mar, 2011 1 commit
    • Daniel De Graaf's avatar
      xen/gntdev,gntalloc: Remove unneeded VM flags · d79647ae
      Daniel De Graaf authored
      The only time when granted pages need to be treated specially is when
      using Xen's PTE modification for grant mappings owned by another domain
      (that is, only gntdev on PV guests).  Otherwise, the area does not
      require VM_DONTCOPY and VM_PFNMAP, since it can be accessed just like
      any other page of RAM.
      Since the vm_operations_struct close operations decrement reference
      counts, a corresponding open function that increments them is required
      now that it is possible to have multiple references to a single area.
      We are careful in the gntdev to check if we can remove those flags. The
      reason that we need to be careful in gntdev on PV guests is because we are
      not changing the PFN/MFN mapping on PV; instead, we change the application's
      page tables to point to the other domain's memory. This means that the vma
      cannot be copied without using another grant mapping hypercall; it also
      requires special handling on unmap, which is the reason for gntdev's
      dependency on the MMU notifier.
      For gntalloc, this is not a concern - the pages are owned by the domain
      using the gntalloc device, and can be mapped and unmapped in the same manner
      as any other page of memory.
      Acked-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Signed-off-by: default avatarDaniel De Graaf <dgdegra@tycho.nsa.gov>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [v2: Added in git commit "We are.." from email correspondence]
  6. 14 Feb, 2011 2 commits