Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2801618rwd; Mon, 29 May 2023 00:41:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7IwzlFpVdEMQWZHCi05G4jVJu7HIlWx3HyATzMdzLvWqxKezIIarbb2jMAe/7sG1IUMzLC X-Received: by 2002:a17:903:18b:b0:1ac:731b:bc9a with SMTP id z11-20020a170903018b00b001ac731bbc9amr7707552plg.27.1685346068174; Mon, 29 May 2023 00:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685346068; cv=none; d=google.com; s=arc-20160816; b=AtsgxjwjWjpQNq9dy2GrteQnyn3Lmu6mCFWH39bX/1GRCWGihYb+EHpSebUG2yAFKa GtCj1eYLOp/luHiVxyKWcUC1N/hJB1Bw0kO+FHGhqrhTZNjumJcF/Jwh/epoSdK1XAQD f179iBCx9pBPm6dLMBAlyj0PNlzxUiZhQyrfPd6t9w9BI4zh0thwfUBCPaYYqo4zCBN7 QX24ToNz3BQ5CBkDyzf/1F1BeRnuT4CXwSmE/KQ280V6i+diF3ufrYwdAw8lP/IW+SUZ okiQOalU4OKRgsjoWEN7NnKtPFlJwfgVcZZak7cvVhcgEuUHjUqFGU1o1XeYmT9pEGx6 JD2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fuA6Mx7qZk6GEXujcE9++nuvrgV08ZyqT/8PAv9VpyQ=; b=B4vuRr7eLxavFnbHCYYsnTUTOc1nnRreFxg19RbDswvooC23kLv3ii82KTXhVkU6ga P7sbCt83BRZkbo77I2ReEz8b/rwU0ptD+jXSoPizRMaT7uDaFBIHROu6Np+YY0SrVSl/ eieaYhr4zmcf12VdalElNoBpULhHaBX+97sS/mMgnIlLugUkGfVH0A4H1Houwmq3WMYK n9nNCSWclSaGb8DYCSQ5p4zPP1yuR7A778+8PHmSHICwz3mpRqPyzxLZG7wRtALWWE4d eBpUpCYMThCyXx9VQabCTuOZ6I2PZDntCyCsRtUOLrZhnGK9f35clN2NSrqZINhgRmVd 7nlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=E+CGf+hS; 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 y15-20020a1709027c8f00b001a511254836si6269299pll.89.2023.05.29.00.40.53; Mon, 29 May 2023 00:41:08 -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=E+CGf+hS; 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 S231447AbjE2HZi (ORCPT + 99 others); Mon, 29 May 2023 03:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbjE2HZf (ORCPT ); Mon, 29 May 2023 03:25:35 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75482AF; Mon, 29 May 2023 00:25:31 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2af1e290921so30115681fa.3; Mon, 29 May 2023 00:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685345129; x=1687937129; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fuA6Mx7qZk6GEXujcE9++nuvrgV08ZyqT/8PAv9VpyQ=; b=E+CGf+hSlas2ziMgKKa6jlYK0xVOwshz/Sz6tFHIvkH+2c2Sf06OVcWnyv3eFsh5LO xv7MLLUghSxQ3ASwLN2a853fG3gq89bwejLL/Q2oomoxGxFfGNuJirlLsb42Pr2J+WB+ 7hHsxD5ckzCRvIyqWo2VDSRuQFe/rAE/d+PHamsWvIFyn2mtQpFbjhSFW3OI/IBmqOZJ ng4Th1aQI1IUHLr1ob4xiD+a1l0PKm0DSm12Iu8uekGM76S9J7Jko0G8Y7rq0iWJJrB5 wZUhcKyHdJCUnFZkmqFOOF9G3ELP8+LiT+EXDwXntA/b+HcoqMXlQKvdU8ezF/4dOQk+ 9hIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685345129; x=1687937129; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fuA6Mx7qZk6GEXujcE9++nuvrgV08ZyqT/8PAv9VpyQ=; b=Y/gOpDyX1eT/PFjf59hFX/RS0nscuaCjodZyc0amoTbMS4FH5NBzzv9771pXtB4cjN vZYQkEtsO+D5mFdDRRjJs7Nh7yUYPebQa9mMf4F4LBh2EORq8OC1io4PZKl+nC/G0fwU +QZ+LpdgYTkhgGEaFkXHV6actAk9sWTWvutvszy/sQUbPPKzkG1koGjXQnOCwIppZcem HPk+sZK5sxQ2IHFV+5aPwwhnOgAbdasGwul9CxTwkJ7ms9+0kgS2WLw5WKY49Ovr7JBp 6bWzrrfXwH4BFm5GhaW1jwNQp+UkDctqUyzD2crYhg1E4SB7dW8qDI7en9b6TFGuuCds FewQ== X-Gm-Message-State: AC+VfDwBZEJ55at8/WsfzkbLMDkNBXdFv5cfzmUtDAwPdj5u/kYYOgZX RtArX41X3W7H1S3G9m7nNE6tIxNzufS+qJWkALI= X-Received: by 2002:a2e:6a18:0:b0:2ab:e50:315a with SMTP id f24-20020a2e6a18000000b002ab0e50315amr3293876ljc.51.1685345129439; Mon, 29 May 2023 00:25:29 -0700 (PDT) MIME-Version: 1.0 References: <20230526054621.18371-1-liangchen.linux@gmail.com> <20230528022737-mutt-send-email-mst@kernel.org> In-Reply-To: <20230528022737-mutt-send-email-mst@kernel.org> From: Liang Chen Date: Mon, 29 May 2023 15:25:16 +0800 Message-ID: Subject: Re: [PATCH net-next 1/5] virtio_net: Fix an unsafe reference to the page chain To: "Michael S. Tsirkin" Cc: Jason Wang , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Sun, May 28, 2023 at 2:29=E2=80=AFPM Michael S. Tsirkin = wrote: > > On Fri, May 26, 2023 at 02:38:54PM +0800, Jason Wang wrote: > > On Fri, May 26, 2023 at 1:46=E2=80=AFPM Liang Chen wrote: > > > > > > "private" of buffer page is currently used for big mode to chain page= s. > > > 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. > > > > If this issue happens only in the case of page_pool, it would be > > better to squash it there. > > > > Thanks > > > This is a tiny patch so I don't care. Generally it's ok > to first rework code then change functionality. > in this case what Jason says os right especially because > you then do not need to explain that current code is ok. > Sure. it will be squashed into the page pool enablement patch. Thanks! > > > > > > 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 =3D (struct page *)page->private; > > > - if (page) > > > + if (!vi->mergeable_rx_bufs && page) > > > give_pages(rq, page); > > > goto ok; > > > } > > > -- > > > 2.31.1 > > > >