]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/hw/ipath/ipath_mad.c
IB/ipath: Don't corrupt pending mmap list when unmapped objects are freed
[linux-2.6-omap-h63xx.git] / drivers / infiniband / hw / ipath / ipath_mad.c
index 72d1db89db8f6d3393154eb542c0b47a39208714..25908b02fbe578f57fd6ee7128ea0c9b22169f32 100644 (file)
@@ -87,7 +87,8 @@ static int recv_subn_get_nodeinfo(struct ib_smp *smp,
        struct ipath_devdata *dd = to_idev(ibdev)->dd;
        u32 vendor, majrev, minrev;
 
-       if (smp->attr_mod)
+       /* GUID 0 is illegal */
+       if (smp->attr_mod || (dd->ipath_guid == 0))
                smp->status |= IB_SMP_INVALID_FIELD;
 
        nip->base_version = 1;
@@ -131,10 +132,15 @@ static int recv_subn_get_guidinfo(struct ib_smp *smp,
         * We only support one GUID for now.  If this changes, the
         * portinfo.guid_cap field needs to be updated too.
         */
-       if (startgx == 0)
-               /* The first is a copy of the read-only HW GUID. */
-               *p = to_idev(ibdev)->dd->ipath_guid;
-       else
+       if (startgx == 0) {
+               __be64 g = to_idev(ibdev)->dd->ipath_guid;
+               if (g == 0)
+                       /* GUID 0 is illegal */
+                       smp->status |= IB_SMP_INVALID_FIELD;
+               else
+                       /* The first is a copy of the read-only HW GUID. */
+                       *p = g;
+       } else
                smp->status |= IB_SMP_INVALID_FIELD;
 
        return reply(smp);