From patchwork Tue Sep 29 10:58:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 290808 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAE1BC4727C for ; Tue, 29 Sep 2020 12:31:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3EDF20759 for ; Tue, 29 Sep 2020 12:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382688; bh=qiRtS79spyb2DRDDCNYa28LMO2xC2pMues6DPNg1Uv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=THK/wikvYgo23DSP/odahojl0RKpzQ5EbpB85vXg/IHEETzcxpu1zGgRvi/7WER1E PtH7eGWhzpnAoeJxqIKP+lcjRj3FRU4+/PykRH08+9VkFOygNxZw1EKO7iGvF0nwQe RrX8N/q0BpUxhpfdPbUtt82GqOkTVEqzWqgPx5OE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729378AbgI2Mar (ORCPT ); Tue, 29 Sep 2020 08:30:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:41564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729184AbgI2L3J (ORCPT ); Tue, 29 Sep 2020 07:29:09 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20C4D221E7; Tue, 29 Sep 2020 11:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378616; bh=qiRtS79spyb2DRDDCNYa28LMO2xC2pMues6DPNg1Uv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SkhCPozC4Yvlx7CkrYCRZG4FpjEqxuU/HMYs5dmenmj1P6XEPiR7dhxLPt0eeWpYW 6u+AEitM21MuBCPX1nk1OvWHa2z6sGJgtyrCYNvGReu9IV6AXjbTfH1g7mFoCJOT2+ t2+Bp8iD/hcyv5BCOD3CyY9kmW9D6f3kERpUC1s4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Averin , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 048/245] rt_cpu_seq_next should increase position index Date: Tue, 29 Sep 2020 12:58:19 +0200 Message-Id: <20200929105949.337277218@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vasily Averin [ Upstream commit a3ea86739f1bc7e121d921842f0f4a8ab1af94d9 ] if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output. https://bugzilla.kernel.org/show_bug.cgi?id=206283 Signed-off-by: Vasily Averin Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/route.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 84de87b7eedcd..3db428242b22d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -274,6 +274,7 @@ static void *rt_cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos) *pos = cpu+1; return &per_cpu(rt_cache_stat, cpu); } + (*pos)++; return NULL; }