From patchwork Mon Feb 3 16:20:02 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: 232092 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=-9.8 required=3.0 tests=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 8A2DEC35247 for ; Mon, 3 Feb 2020 16:47:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5037F2051A for ; Mon, 3 Feb 2020 16:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580748457; bh=ud4UxmXveAjSSNyHYAXdWglwo6mPcrhBtKmMNcvwCs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ic5aC2IA/9nxMzRfQw14sUdTrTlExWJOiGLtgGrkUzSVePZdugeXrSAV39UY9ZSNk JxyfGQ5qTj6mI8diUCrfl5rgb0JdMwqKHrw1Vpks+r5f//I7GhYPaiFAZow+xGTTlP AnYYhbnF+c+ogkuA/LtEQ+n6UDyplE/eB+9CPpzE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728496AbgBCQ1N (ORCPT ); Mon, 3 Feb 2020 11:27:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:38388 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729353AbgBCQ1M (ORCPT ); Mon, 3 Feb 2020 11:27:12 -0500 Received: from localhost (unknown [104.132.45.99]) (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 A55B920838; Mon, 3 Feb 2020 16:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747232; bh=ud4UxmXveAjSSNyHYAXdWglwo6mPcrhBtKmMNcvwCs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogqPbk28h0Y8NadpFGXhk7l9VEYPMqFbWCWvh/HjqQIU9Cxenc4M4kuGa5N/9mBv2 Dq/crIxeselwWJmRE2YTLUdV33HZK269WpKOs67G19lpXZNG03o5hwyMADVunIc4zz FPdOVwuXjUwv/1kTLrE1iHordDsv1cBjrwGlXUCU= 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.9 66/68] seq_tab_next() should increase position index Date: Mon, 3 Feb 2020 16:20:02 +0000 Message-Id: <20200203161915.682858455@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161904.705434837@linuxfoundation.org> References: <20200203161904.705434837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vasily Averin [ Upstream commit 70a87287c821e9721b62463777f55ba588ac4623 ] 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 --- drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 61c55621b9589..c150521647172 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c @@ -66,8 +66,7 @@ static void *seq_tab_start(struct seq_file *seq, loff_t *pos) static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos) { v = seq_tab_get_idx(seq->private, *pos + 1); - if (v) - ++*pos; + ++(*pos); return v; }