Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1595998rdb; Thu, 7 Dec 2023 03:58:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvVNoYC/+QdpXjt+9qZn1nlbwL8ZEkdAtByU/dkFbfi2gvvh+5zrMSQaHhlfX90xlQnUJq X-Received: by 2002:a05:6820:16a9:b0:58a:67b5:2df1 with SMTP id bc41-20020a05682016a900b0058a67b52df1mr2806619oob.0.1701950290674; Thu, 07 Dec 2023 03:58:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701950290; cv=none; d=google.com; s=arc-20160816; b=fBoVVzrdhrc6VfLu6niFzW2+Bluq7LIqCl/w+lSk27fk8p/OXb56uYxdMIS0tHEUQO LpRQ/g1ENfiA6QFyKp3JBv8qSc95qr0T9DAB/iNpTAL5YwBOxzJahqV5iEocjR9rCvFt EKprb141XeKi/PAFYc5GXhaHm51m8bSOvMqQw8CRSaMEtFYSx66jDky5BjUxadsRBAbb v0uDYbJxat09U++egCCaXoeTBARLeJqU0b4PG63V8P1a2ZeK9bmQt4c2IBn7QCJF2VJ5 kgCTlutGW17cFVFXIFaU7jKXTP2qnM49bIOzmElXuZUG9Q0ZPg6nCofwh5svqZzvqRC3 nsdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BNInQ0LIsk476kI3RDIC5pmvm/aYp1xsNMJUqUWotqc=; fh=wDWLlTjjJjhc8Q2+UvPlEUQKQen7+nYR3qEtl80Nvbo=; b=ewrRECkUMw4u6dVEHD7/ftL2ZkrXu1pwu8oIefSTE60/RGUJvaKSb1hg94jcYnZrpj QGH2PCr/h1hlRm5HC3adP/8lXuYDt8Nvuh+qbMli1be/8kmXZo3klEr9Te1XI5RNvJoK e7hfDMDsZ4dXXiEHyKEd6H0OvPFexBJ5KVmbmAZnxsDyylrdRedX7rom0BNsMT1pNWf5 emekeXOHZzv6uNyWZgRT2ubkswEKBWIC9tUd9vplpfCq5GJDPMHTfnu+Ufmya1DzoGyx ASYfIiVv6c9GPDS9Tb/HVKvpeKSUF6K43eiqo9k2GkVhgINEQ9dbh6qBI/J7rv7odEJ7 4VEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g4JRmYPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l8-20020a6542c8000000b005c663502394si1049631pgp.609.2023.12.07.03.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 03:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g4JRmYPD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B25908027B67; Thu, 7 Dec 2023 03:58:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379097AbjLGL5v (ORCPT + 99 others); Thu, 7 Dec 2023 06:57:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232482AbjLGL5u (ORCPT ); Thu, 7 Dec 2023 06:57:50 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07231D4A for ; Thu, 7 Dec 2023 03:57:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61DB6C433C8; Thu, 7 Dec 2023 11:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701950276; bh=ZadLVg2xVw24qHq11LzSKHwhUbpz7A2+VUUzqsY+gLI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g4JRmYPDzmJcuIpWDoFr/AgUuC/LimYiBWcKw4SKa/rIIAtvW5457js1EIRnSAKp9 oiaGYfk70CtpyYTBw7P9x+5nAzh8+51Ivyiep0AfKrmW2Ww+vIRA8i6a0rtKk3weII o+wouwc0EAcKUT2uFS0BbXEm0oLi8+yTfqEBSPcHVKvp0TBzTatvJnyQkTFJsHDZbF xHeb6fw4PLDs0XjSz73zpfC5U4skvJPyA4sKyyFciJECWNNLeAmY2NZ28yHa/wwV2j gky0Np8hxDExwZzEjtV/D0cvI8PYHhAobsq0ipFtKJxLs4lGyDG49/GfnvnDYedEEg VsCQ/2YvkuYgw== Date: Thu, 7 Dec 2023 11:57:51 +0000 From: Simon Horman To: Alexander Lobakin Cc: intel-wired-lan@lists.osuosl.org, Michal Kubiak , Przemek Kitszel , Maciej Fijalkowski , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH iwl] idpf: fix corrupted frames and skb leaks in singleq mode Message-ID: <20231207115751.GG50400@kernel.org> References: <20231201143821.1091005-1-aleksander.lobakin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201143821.1091005-1-aleksander.lobakin@intel.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Thu, 07 Dec 2023 03:58:08 -0800 (PST) On Fri, Dec 01, 2023 at 03:38:21PM +0100, Alexander Lobakin wrote: > idpf_ring::skb serves only for keeping an incomplete frame between > several NAPI Rx polling cycles, as one cycle may end up before > processing the end of packet descriptor. The pointer is taken from > the ring onto the stack before entering the loop and gets written > there after the loop exits. When inside the loop, only the onstack > pointer is used. > For some reason, the logics is broken in the singleq mode, where the > pointer is taken from the ring each iteration. This means that if a > frame got fragmented into several descriptors, each fragment will have > its own skb, but only the last one will be passed up the stack > (containing garbage), leaving the rest leaked. > Just don't touch the ring skb field inside the polling loop, letting > the onstack skb pointer work as expected: build a new skb if it's the > first frame descriptor and attach a frag otherwise. > > Fixes: a5ab9ee0df0b ("idpf: add singleq start_xmit and napi poll") > Reviewed-by: Przemek Kitszel > Reviewed-by: Michal Kubiak > Signed-off-by: Alexander Lobakin Reviewed-by: Simon Horman