IB/core: Clear AH attr variable to prevent garbage data
authorDevesh Sharma <devesh.sharma@emulex.com>
Fri, 26 Sep 2014 15:15:32 +0000 (20:45 +0530)
committerRoland Dreier <roland@purestorage.com>
Tue, 14 Oct 2014 07:29:06 +0000 (00:29 -0700)
During create-ah from userspace, uverbs is sending garbage data in
attr.dmac and attr.vlan_id.  This patch sets attr.dmac and
attr.vlan_id to zero.

Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures")
Signed-off-by: Devesh Sharma <devesh.sharma@emulex.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/core/uverbs_cmd.c

index 0600c50..5ba2a86 100644 (file)
@@ -2518,6 +2518,8 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
        attr.grh.sgid_index    = cmd.attr.grh.sgid_index;
        attr.grh.hop_limit     = cmd.attr.grh.hop_limit;
        attr.grh.traffic_class = cmd.attr.grh.traffic_class;
+       attr.vlan_id           = 0;
+       memset(&attr.dmac, 0, sizeof(attr.dmac));
        memcpy(attr.grh.dgid.raw, cmd.attr.grh.dgid, 16);
 
        ah = ib_create_ah(pd, &attr);