Received: by 10.192.165.148 with SMTP id m20csp763882imm; Fri, 27 Apr 2018 07:10:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrmFcGwN+auPlH5Y5EnLosSZsdL81mVHTIQc6YiaE/fFo+KR7J4ZwW/DuAI9A4Gj3qrOimb X-Received: by 10.98.66.143 with SMTP id h15mr2391172pfd.156.1524838218556; Fri, 27 Apr 2018 07:10:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524838218; cv=none; d=google.com; s=arc-20160816; b=WOOqeh/u+ZUG5yMjmNC3s788uwZiWreQigS40IzXHm8aRedD1pLJzfMQx1U7s3popK o5CDUwzqy44MMh7KsGn2+DKkBcJ9LxxeicDjmy5eg+YuYUaFTPnfOUJDxxeKQwU7j7YN 9kzemie69bL8gjNp1Uf4L4YAqtLAZAqJZEPxofoe7LEGeava0IZZgxMRB+6N9eQaWd0l s5tTQ7P58hHHjFj4qvru/AAbI1DlIjAYjq0fdpJi+jz7vPxwjXXnQiRQlJcz+ChBHte9 noyvo+288gh7PfCbr3meAljcuBt1seLtZKWO3fuxUdE1zXnfCxDlYx79U75u047ebUIx 2phw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=UpA72rH1ALA4jfnlEqgU3RTsM7upV8eKOvd/NoBFtsA=; b=AA33rAtmB1sgSMDqgIKnpc1fE9521zMOzH8lNMdg3ELDLAVN4ZPtJir8/yrxeFvwYu PqW4lR9RBGaaikv9il8vSj7+J+dYtt8dY2UrG2AISFexW+zlUrU5gfyOPD4XjGLQ4ZUJ 7mmyHHKQT8GQyrY3n221c9KE8Wp9RZ1LVC2nnRbkQvp42Z7SfWYL1pClRkcJIsNcypex hHLZLxJXaRN/XiEg3+UJsZ4HoGEhKU5bj31Z92w+y27P7xU8+aG9R+HbQyyRsa1sFcvD 1pOh3p1XY+rMdRyhy6Kfi/5cVXGPZQKkL9a5DQ6Z2IJSQihH6PL336FrqDeuXTJEZvkR Fr6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1-v6si1317374pga.417.2018.04.27.07.10.04; Fri, 27 Apr 2018 07:10:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934603AbeD0OI6 (ORCPT + 99 others); Fri, 27 Apr 2018 10:08:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:54388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934230AbeD0OIz (ORCPT ); Fri, 27 Apr 2018 10:08:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 42AEA21864; Fri, 27 Apr 2018 14:08:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 42AEA21864 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Michael S. Tsirkin" , Jason Wang , "David S. Miller" Subject: [PATCH 4.14 40/80] virtio_net: fix adding vids on big-endian Date: Fri, 27 Apr 2018 15:58:33 +0200 Message-Id: <20180427135734.984034440@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135732.928644313@linuxfoundation.org> References: <20180427135732.928644313@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Michael S. Tsirkin" [ Upstream commit d7fad4c840f33a6bd333dd7fbb3006edbcf0017a ] Programming vids (adding or removing them) still passes guest-endian values in the DMA buffer. That's wrong if guest is big-endian and when virtio 1 is enabled. Note: this is on top of a previous patch: virtio_net: split out ctrl buffer Fixes: 9465a7a6f ("virtio_net: enable v1.0 support") Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/virtio_net.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -123,7 +123,7 @@ struct control_buf { struct virtio_net_ctrl_mq mq; u8 promisc; u8 allmulti; - u16 vid; + __virtio16 vid; u64 offloads; }; @@ -1602,7 +1602,7 @@ static int virtnet_vlan_rx_add_vid(struc struct virtnet_info *vi = netdev_priv(dev); struct scatterlist sg; - vi->ctrl->vid = vid; + vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, @@ -1617,7 +1617,7 @@ static int virtnet_vlan_rx_kill_vid(stru struct virtnet_info *vi = netdev_priv(dev); struct scatterlist sg; - vi->ctrl->vid = vid; + vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,