Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2085229pxb; Fri, 5 Feb 2021 08:38:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyI1uZJEz4dU+/pia/j8dKTx3TEfiHHRsniVo02YfM9f5GEO70RkrO0Mc5E+YMi45mnn+vf X-Received: by 2002:a05:6402:1642:: with SMTP id s2mr4223435edx.360.1612543120188; Fri, 05 Feb 2021 08:38:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612543120; cv=none; d=google.com; s=arc-20160816; b=cZiJ3XF0DbgY4KGmy4ldZVc1fNyQ7AoGCzGvskHpMNOcpPw7Jud/LfzJMrRl5Ls+qR jhrFCjHWevN/XbdsMuEeb/OzqPcDs8SFGQp6CaLz/75QF6Sj5WkISCmSi41TpixtboLP 8ZEwQSCayEVoRDfgjzU4n712ihbf9o3PzZIn/EFXRZOLBPQeaQ3LB1Y4qnR8Y3mB5ze7 b3uN6/Ts37GeyB/b0LrgqcvMN0T+k39upeIBOg5fCd60zmspUOwFflN5UGH1jRS7Z7ri nqXClhROv8hehbu/PQXQ1EAtW0ZoNb2+l9OMwaaR146ojVEexa3WStkrKKjhvLCZWfi8 YA/Q== 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=79c3C5DFNJ8WA8GjidhCQlz0ze6LMsMDakYhczjboWk=; b=E08chSMlBJ9PlgP3GutcByOb7xEjGMzxE2chiLq/+mLce9tZ9pRxpDfGPUqVS3SK70 5aGNpV8XGSa9qLrM6wq/UWOvslyzAxtkq5FWaBWIzxaRBG700VH5l/Bv5GhoRM4a9qVr 6fCAba90aiMO5BU+opPmTyV/CZDtafZTFmE8apOcKFxSaVWcFyumMCDwSqXM03vF2KWh KsvhCmSQguN7Jvqc6vola3mmeMYPc8CmKRmLKeu7zNlLY85JqMn07REn/qPKKIjlgcXu IrobA1fl5qsg8TIEiwDLfzSfiBqgOZ2VdJ3J1RJaiokGyfN58wzZGLzS6PqPJEqv8maR /Qxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IYWurr9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p62si5601410edp.242.2021.02.05.08.38.14; Fri, 05 Feb 2021 08:38:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IYWurr9p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232954AbhBEO5T (ORCPT + 99 others); Fri, 5 Feb 2021 09:57:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231749AbhBEOwd (ORCPT ); Fri, 5 Feb 2021 09:52:33 -0500 Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EE7BC061786; Fri, 5 Feb 2021 08:31:03 -0800 (PST) Received: by mail-qk1-x72d.google.com with SMTP id u20so7435320qku.7; Fri, 05 Feb 2021 08:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=79c3C5DFNJ8WA8GjidhCQlz0ze6LMsMDakYhczjboWk=; b=IYWurr9pqj0rjJmEfMg1YrQWHhA/HUTt5Jo8vEy75RWmPmgdpgkgICp/PVBHuTtFGo md6JRzrGd/vigb2Jq/ogGh11jr+KA/CwmAMH7/Z2l8xQkQRTLle7x31F0BNqOc1Rs/bp PkyiGNKCxbKqn9jWReL0X9MyBqkSUAhnBtppt6o0jnPXJKmzdxyDhMGS5tfLDe7D6YR3 CmU8lPuze4Fo59V8oXSukcRTBTN5ptw9hNdWTtU+uoDtQmtsqrxGinfdptMdJHr/hSls YrMMk4BtpJWIbdr/dUYmUe4eFgo5iaoQlCF4Y3R+WAblZWnMFLaMYQyrjRSoUJgGmdgc tenQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=79c3C5DFNJ8WA8GjidhCQlz0ze6LMsMDakYhczjboWk=; b=fLxbVKXSp2Tzm3qy0H+1+Sneal5Hsilye2yZH0yHjPTsx7ClGmC5IX52GvV+QucXkl 2/J15Fr13TYy5nnPOycXtLLNPLxuWcW5sJCxueA8FWzKRXY+LnyxPzkjDzJsfoHczZWe 9jQg/86JgmWkmlhWG8HK0cdh6BKZyDZN6+njtMB8l//XzrX9iYMMqk7lq6/k67qVGYd5 SfWnEKDcF1QnCO1XgIQGQ/BiamK3af24UKc64150LC5d0wrOu1h2FC8yiHMO5M5dHf02 FpIJyszNKXSz8LAGK7y9yoqO/yTOHdY5DmZoRFDUdXq6mijepVIWuIvcZvBJS6yJ+1t3 mH/w== X-Gm-Message-State: AOAM533pasKJ4qGcw3H8VQjd3GB1zCzBm8uHG3OMsstzW9V5BxYiulcU 8mkuR4pXaxiTy5CMWaFEWsW1u+kTFZyPuQ== X-Received: by 2002:ac8:7757:: with SMTP id g23mr4383003qtu.305.1612535564872; Fri, 05 Feb 2021 06:32:44 -0800 (PST) Received: from horizon.localdomain ([177.220.174.167]) by smtp.gmail.com with ESMTPSA id p188sm9477098qkf.89.2021.02.05.06.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 06:32:43 -0800 (PST) Received: by horizon.localdomain (Postfix, from userid 1000) id B2339C147D; Fri, 5 Feb 2021 11:32:40 -0300 (-03) Date: Fri, 5 Feb 2021 11:32:40 -0300 From: Marcelo Ricardo Leitner To: NeilBrown Cc: Andrew Morton , Alexander Viro , Vlad Yasevich , Neil Horman , Xin Long , linux-kernel@vger.kernel.org, "David S. Miller" , linux-sctp@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 3/3] net: fix iteration for sctp transport seq_files Message-ID: <20210205143240.GA3406@horizon.localdomain> References: <161248518659.21478.2484341937387294998.stgit@noble1> <161248539022.21478.17038123892954492263.stgit@noble1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <161248539022.21478.17038123892954492263.stgit@noble1> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 05, 2021 at 11:36:30AM +1100, NeilBrown wrote: > The sctp transport seq_file iterators take a reference to the transport > in the ->start and ->next functions and releases the reference in the > ->show function. The preferred handling for such resources is to > release them in the subsequent ->next or ->stop function call. > > Since Commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration > code and interface") there is no guarantee that ->show will be called > after ->next, so this function can now leak references. > > So move the sctp_transport_put() call to ->next and ->stop. > > Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") > Reported-by: Xin Long > Signed-off-by: NeilBrown Acked-by: Marcelo Ricardo Leitner