From patchwork Thu May 21 11:45:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11562779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6AAD290 for ; Thu, 21 May 2020 11:45:43 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D6782070A for ; Thu, 21 May 2020 11:45:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D6782070A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id E4013602F114; Thu, 21 May 2020 11:45:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org E4013602F114 Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D4AE15E8A9D6D; Thu, 21 May 2020 11:45:41 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 443B05E8A9D6C; Thu, 21 May 2020 11:45:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 85BF25E8A9D67 for ; Thu, 21 May 2020 11:45:36 +0000 (UTC) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 0B254605D2EA for ; Thu, 21 May 2020 11:45:36 +0000 (UTC) Received: by mail-pj1-f66.google.com with SMTP id q24so2918505pjd.1 for ; Thu, 21 May 2020 04:45:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NEeHvkRGONHvenIKH6XowKLuNwQCzlrZ0W9Q8ClPMNY=; b=jYfnbvC/7mrFw4LLg6L+vAv2WdFUh5QUDQgN5/JV5cCcHxGYVW8c7Aau/oFlpBjY2n CIEckvAj45ll9fnWRi82fD6rRrmGHYiqmYBSmvtxfmPE6hdYLefO0hbH8XPNYvmtN5Yq jldxv3TLNkTiwyOd6PM79H3OdaE4blZxRyuQoymYkaBA3N0Q5Cm1ht8UljmlKY1i2V6T 7iK3pQ49ufFfysP4z0tbalmz24IS3UroCNZT40PugaXkCzE51VPnCnyWjkNuoSoQEvYI Ha6MU9Q5eD24hlg2xxq9mKv5jJ9IH61Xrvwo4jlMue4cde2iVOED7PNoyGHuyi8TKY+J nrQA== X-Gm-Message-State: AOAM530Miu2tC2ptzAdAezHn6obTrPDiXQkWTcwZTZJmJGWtac0xrU9s cu+BCJUZuYOzLH0GKeVgzNgEonmtHbSp4g== X-Google-Smtp-Source: ABdhPJz2KhqX9vCnF4W+tt4tGbvyz6GdsxlpmlGtvfbnhD8gnFrvoKRQg0BBzgUepDM9WFCV1FBOPQ== X-Received: by 2002:a17:90a:3b42:: with SMTP id t2mr11032272pjf.11.1590061534721; Thu, 21 May 2020 04:45:34 -0700 (PDT) Received: from dhcp-12-153.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id y22sm4576860pfc.132.2020.05.21.04.45.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2020 04:45:34 -0700 (PDT) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [PATCH libteam] teamd: fix ctx->hwaddr value assignment Date: Thu, 21 May 2020 19:45:22 +0800 Message-Id: <20200521114522.230775-1-liuhangbin@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Message-ID-Hash: 6YMGYAHE2POQGU2VR3N22NOMWG5TANBU X-Message-ID-Hash: 6YMGYAHE2POQGU2VR3N22NOMWG5TANBU X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jiri@resnulli.us, Hangbin Liu , Li Liang X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: 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 Suggested-by: Xin Long Fixes: 9ca6bf9 ("teamd: update ctx->hwaddr after setting team dev to new hwaddr") Signed-off-by: Hangbin Liu --- 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; }