Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1966315rwd; Thu, 25 May 2023 22:51:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rNFxptoOTJ93rujly6DRmprFGc40r3Gk7dmzIWTpTHDnKxZWSuthQw8Qidnh/Gdqk8KcR X-Received: by 2002:a05:6a21:1190:b0:10e:c8b3:8d3d with SMTP id oj16-20020a056a21119000b0010ec8b38d3dmr831639pzb.33.1685080284415; Thu, 25 May 2023 22:51:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685080284; cv=none; d=google.com; s=arc-20160816; b=soFKwvj/o4iaxTYE5uumzJGvYeZWE4MRinSi2GodiUYD15Kctk93w0qebCbCrCCZ3j n+k+ftrFJAro8gb3qlMwSXMuEj2a+X4JpAVbflplxi6Yjf3d3gZk91MoF1Grb7PbRqzB F3xXmJwE4nNLzaloRi9Lxvn4NCLlCCa/ThhSoC0sqbD8RPcnHaw+Y/meGqgfvbe+j+N2 xfix8TSQmsOF2OAjjHEjt2W0Edtdr0kc7j7zZUk4zbg4/gmeDeN8ae/ajXYfp9rvolUa zvvJFMgLWUnwXu0FJoUbO02hyRdKU23WJzKGuZ+6K32JjQWMMMxNK8926HNOkda1ZEmP EVSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=e5YxXu7+kAm16FYH0MM9J1g3Z4tXK64P/Yef0oEkw/I=; b=E6FqvSLenDyNkrW++PUNOdkO7vr/xN9oamFZNz3Fv+27YdibQJ7Ns1yYPQRGBLYrSs 4QpqIqQ6zpLd5REhZ15+qwC54kHmhfOrpLhse3EhPd98bl53KrxfbiI1h1sG8IV3DIia K/FtM9q0HcH3pnkpY7PxdgWYNAATH+EPQCLPNtStfp2RPZwCx4aFqVo91fYil1i+jKXR OVkUgLlN44H+92Obpe6bmFGof/dYu6ZVxA1uMMLseuZvocULhDnZMN/CH10OMzY/OxBy GW65WK04bH1V12qQSCok0d1pc9tFXsI9FEwldxVD7NFmDyLfBfPM/zSMmdfI4g8VLJZg Kytw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qUlQ8WHg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a631854000000b0051423af249fsi2863796pgy.304.2023.05.25.22.51.11; Thu, 25 May 2023 22:51:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=qUlQ8WHg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233317AbjEZFql (ORCPT + 99 others); Fri, 26 May 2023 01:46:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjEZFqj (ORCPT ); Fri, 26 May 2023 01:46:39 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED5D218D; Thu, 25 May 2023 22:46:38 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-64d2f99c8c3so451505b3a.0; Thu, 25 May 2023 22:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685079998; x=1687671998; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=e5YxXu7+kAm16FYH0MM9J1g3Z4tXK64P/Yef0oEkw/I=; b=qUlQ8WHgMYaTUXyuLclzG5jl4IGHhzf8aaf6PDLaN5rgzB5eNdGCj32w/4dLzU8kMv 2ChzWrBpmLTJE69zw4V5Njx0sHdYTnRqpCL6sdDsRoYtIjfXv4hJ6gIfgsyj36DDD8HJ DmassvZ0KvRsMYd9aSzBczk20prYxDmj0k014QHezqoeArDVDdCstj3FZa//ke5uIS1+ XLkgy7ENSRoxqQkx9/oGHANG1Fy/kr4uQtPqbWlvwxLmm+0u2xK98Wsv90QJnVR7W5fY 5HnBaDmB7Rifu5lSJdrCgoKUwPGK+fbanzM0J/1vOl5JwrjFi7K7Mzu/VcndTToJO3s3 JXlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685079998; x=1687671998; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e5YxXu7+kAm16FYH0MM9J1g3Z4tXK64P/Yef0oEkw/I=; b=QDofYx5+qr5qI8IgDvSiJ1srs9F+ufZVie3z5YP6R4r6oN000XIpfecN5i+fSqg4nv T6qV9TN+xleE7/PoMwYjY7Es6FVsHRBLj70pleIbPmv1pglsa1ZIht+z0QkCsYlspfWt DnG8cMAE6pbXSFdiMAda8hrXx4DJiid17QJZbsaAARCuoQqPJt7NYeCW41jx0EekweAu ixX0JRZtwCXJdbISUtKnshpJHNYztioeBke0CXMtA7p65d4KesB+qaSNl8NSGRbU9Eij aIqYj+GfwAHB4n82afzGR3+dfCOnP+ptvCEBOSxJQpxxDod7RIidBaIByYixFoC5zjWc SkmQ== X-Gm-Message-State: AC+VfDyHSaY+nZoUKlpPmHbSUdfHtmwbm/YzjNB53YNS+l1TcvS+ivXI LvyUQjiC1oRRk2oliUX6WSC1d5wjszk= X-Received: by 2002:a05:6a20:2584:b0:10f:3d02:863 with SMTP id k4-20020a056a20258400b0010f3d020863mr1035895pzd.9.1685079998416; Thu, 25 May 2023 22:46:38 -0700 (PDT) Received: from localhost.localdomain ([104.149.188.130]) by smtp.gmail.com with ESMTPSA id b23-20020a6567d7000000b0050a0227a4bcsm1836485pgs.57.2023.05.25.22.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 22:46:37 -0700 (PDT) From: Liang Chen To: jasowang@redhat.com, mst@redhat.com Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xuanzhuo@linux.alibaba.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, pabeni@redhat.com, alexander.duyck@gmail.com, Liang Chen Subject: [PATCH net-next 1/5] virtio_net: Fix an unsafe reference to the page chain Date: Fri, 26 May 2023 13:46:17 +0800 Message-Id: <20230526054621.18371-1-liangchen.linux@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "private" of buffer page is currently used for big mode to chain pages. But in mergeable mode, that offset of page could mean something else, e.g. when page_pool page is used instead. So excluding mergeable mode to avoid such a problem. Signed-off-by: Liang Chen --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 5a7f7a76b920..c5dca0d92e64 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -497,7 +497,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, return NULL; page = (struct page *)page->private; - if (page) + if (!vi->mergeable_rx_bufs && page) give_pages(rq, page); goto ok; } -- 2.31.1