Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp806526rdb; Fri, 6 Oct 2023 23:13:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeCoOTxXRau7a8qKKgGEuTLoTgVGVASuykoMCbcmOGYpgMKZwuPCGccOjnuUIplXT+jRDS X-Received: by 2002:a17:902:788a:b0:1c5:c23c:a9ff with SMTP id q10-20020a170902788a00b001c5c23ca9ffmr9570565pll.58.1696659207405; Fri, 06 Oct 2023 23:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696659207; cv=none; d=google.com; s=arc-20160816; b=zinRWyUKy05++iNi0yRARNOggCza261toKybk4Yf4LuwKljl6ea/MvGF45oTcxPvY1 Uvb+IZKN8HE5AnHypkVFv0lJrK0H9Nx7VQ89w85h7YQ0sM9SbRZHfjlmq3mc03t73tu6 IWjWpVNPHzZQ5iuY/Hls/M3NPb6lwNQQ/Q+mC3cyypa3fNxQssInhEAzSd1G7iNmR4Bh UKTzA+Q3I7RlVjHU2/S19G/pW4KQgQ9wRu2QQZFRmPSbrphhekCh+Ju9ljY0MiGf/Whw bMNPyoD6IutxwRV6mEtpd2GG3nj/HErrzCMxV5xL9FiGg8smuvN8F+ygl90z3+SyTTW6 aM9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id; bh=aJ9xLC0AWVVRW/157X9wZNaujb4hGXg6kpItcK+sq1A=; fh=T0B+iOFWxYm7hUeOJWJcm/fcedQepSqBepIyXxneNKE=; b=y91V0jAaQvlfUELxrBePYK7aINNa3cnEc6V0XU1opZByWCk8ETWgJdsLUXyYcShYTp sq4EXxbSmcDjAmqj0mFrok0+v1DXcZbROn+R5MgEmaxmsssABm7Bz68KgRrff3LvIjc/ 6tv/Xprh+pr/5sQ8XrU2LpNYTQHN7xktzREyOHAlis6+y74Nsh2MZME5B6F0F2UV4iO8 e8/P18nLgOuQg9f+Zfs67JtxsikzMg0Ir3rhoFVIxRGLBHo4Irdbs3ilv3vg7BxRFAcQ 2FuKaYsRfclhc53AM/5a9luCa4uCInX/4SIDlzq5pNkArSGgwxyLlzvo3C/wwZkk2t1P Dy+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m10-20020a170902e40a00b001c6178a6b7asi4813169ple.639.2023.10.06.23.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 23:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C257180236FE; Fri, 6 Oct 2023 23:13:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343540AbjJGGNV (ORCPT + 99 others); Sat, 7 Oct 2023 02:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343510AbjJGGNV (ORCPT ); Sat, 7 Oct 2023 02:13:21 -0400 Received: from www.kot-begemot.co.uk (ns1.kot-begemot.co.uk [217.160.28.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19D32BB for ; Fri, 6 Oct 2023 23:13:19 -0700 (PDT) Received: from [192.168.17.6] (helo=jain.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qp0YY-003YDr-MS; Sat, 07 Oct 2023 06:12:54 +0000 Received: from madding.kot-begemot.co.uk ([192.168.3.98]) by jain.kot-begemot.co.uk with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1qp0YU-00EeYm-0R; Sat, 07 Oct 2023 07:12:54 +0100 Message-ID: Date: Sat, 7 Oct 2023 07:12:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] um: vector: fix return value check in vector_mmsg_rx Content-Language: en-US To: Ma Ke , richard@nod.at, johannes@sipsolutions.net, xiangyang3@huawei.com Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231007005104.3994678-1-make_ruc2021@163.com> From: Anton Ivanov Organization: Cambridge Greys In-Reply-To: <20231007005104.3994678-1-make_ruc2021@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -2.0 X-Spam-Score: -2.0 X-Clacks-Overhead: GNU Terry Pratchett X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 23:13:25 -0700 (PDT) On 07/10/2023 01:51, Ma Ke wrote: > In vector_mmsg_rx, to avoid an unexpected result returned by > pskb_trim, we should check the return value of pskb_trim(). > > Signed-off-by: Ma Ke > --- > arch/um/drivers/vector_kern.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c > index 131b7cb29576..c280ce5ea6ce 100644 > --- a/arch/um/drivers/vector_kern.c > +++ b/arch/um/drivers/vector_kern.c > @@ -1013,8 +1013,8 @@ static int vector_mmsg_rx(struct vector_private *vp, int budget) > skb->ip_summed = CHECKSUM_UNNECESSARY; > } > } > - pskb_trim(skb, > - mmsg_vector->msg_len - vp->rx_header_size); > + if (pskb_trim(skb, mmsg_vector->msg_len - vp->rx_header_size)) > + return 0; > skb->protocol = eth_type_trans(skb, skb->dev); > /* > * We do not need to lock on updating stats here That does not look right. You can have errors when processing an individual packet. That is not a reason to bail and you should process the next ones. This way you just dropped the rest of the RX vector (up to 64 packets at default settings). -- Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/