libteam/SOURCES/libteam-teamd-fix-ctx-hwaddr-value-assignment.patch
2021-10-08 13:07:56 +00:00

36 lines
1.2 KiB
Diff

From bbffa4223299c18e9886e423f80909b560713e5e Mon Sep 17 00:00:00 2001
Message-Id: <bbffa4223299c18e9886e423f80909b560713e5e.1590163956.git.lucien.xin@gmail.com>
From: Hangbin Liu <liuhangbin@gmail.com>
Date: Thu, 21 May 2020 19:45:22 +0800
Subject: [PATCH] teamd: fix ctx->hwaddr value assignment
We should use memcpy to copy the data to ctx->hwaddr.
Use ctx->hwaddr = hwaddr will change the ctx->hwaddr to
a wrong address and cause the team hwaddr unable to be updated.
Reported-by: Li Liang <liali@redhat.com>
Suggested-by: Xin Long <lucien.xin@gmail.com>
Fixes: 9ca6bf9 ("teamd: update ctx->hwaddr after setting team dev to new hwaddr")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
teamd/teamd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/teamd/teamd.c b/teamd/teamd.c
index f955b19..9360cbf 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -896,7 +896,7 @@ static int teamd_hwaddr_check_change(struct teamd_context *ctx,
teamd_log_err("Failed to set team device hardware address.");
return err;
}
- ctx->hwaddr = hwaddr;
+ memcpy(ctx->hwaddr, hwaddr, hwaddr_len);
ctx->hwaddr_len = hwaddr_len;
return 0;
}
--
2.18.1