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(a)redhat.com>
Suggested-by: Xin Long <lucien.xin(a)gmail.com>
Fixes: 9ca6bf9 ("teamd: update ctx->hwaddr after setting team dev to new
hwaddr")
Signed-off-by: Hangbin Liu <liuhangbin(a)gmail.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.25.4