瀏覽代碼

IB/core: When marshaling uverbs path, clear unused fields

When marsheling a user path to the kernel struct ib_sa_path, need
to zero smac, dmac and set the vlan id to the "no vlan" value.

Fixes: dd5f03beb4f7 ("IB/core: Ethernet L2 attributes in verbs/cm structures")
Reported-by: Aleksey Senin <alekseys@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Matan Barak 11 年之前
父節點
當前提交
a59c5850f0
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      drivers/infiniband/core/uverbs_marshall.c

+ 4 - 0
drivers/infiniband/core/uverbs_marshall.c

@@ -140,5 +140,9 @@ void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst,
 	dst->packet_life_time	= src->packet_life_time;
 	dst->packet_life_time	= src->packet_life_time;
 	dst->preference		= src->preference;
 	dst->preference		= src->preference;
 	dst->packet_life_time_selector = src->packet_life_time_selector;
 	dst->packet_life_time_selector = src->packet_life_time_selector;
+
+	memset(dst->smac, 0, sizeof(dst->smac));
+	memset(dst->dmac, 0, sizeof(dst->dmac));
+	dst->vlan_id = 0xffff;
 }
 }
 EXPORT_SYMBOL(ib_copy_path_rec_from_user);
 EXPORT_SYMBOL(ib_copy_path_rec_from_user);