From patchwork Mon Feb 3 16:20:13 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: 232115 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 788D2C3524D for ; Mon, 3 Feb 2020 16:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 463352086A for ; Mon, 3 Feb 2020 16:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580748294; bh=FokpwCo7yq9QcNvC9K+1UdYma9BMD+zI5H/clmdOOyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UkXLXKP+nNOpFKyk5Yik3hPiHqC3sm0ONua5Jne91BiljwPtEL83TtSwZMtzK1X6k rtfoAyNymdm9N7MNVHQmW52rpyY//H5cfy/6DV5GY1OjKAWgR/HnRFA3oPsswnIfs8 AuW9OZQBH0Tvj3Hxj+Wtqnn7pL4JXtJcV+JJE7Q4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729516AbgBCQau (ORCPT ); Mon, 3 Feb 2020 11:30:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:43696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbgBCQau (ORCPT ); Mon, 3 Feb 2020 11:30:50 -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 22E492080C; Mon, 3 Feb 2020 16:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580747449; bh=FokpwCo7yq9QcNvC9K+1UdYma9BMD+zI5H/clmdOOyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LYQ9rWWTnFalH3MUS+eU+XG3LynLMN2DADDhMVOaYeC+dFab8K/tHU9hOzKOfoejQ Pb+ISopidrvbASYxwva85FstKHjreiqH2BLrN16Nf3DKE+cWeFoCeWf9VTRIXGlLMj fihAwcp4/QBcVX8HsuEcBi1xUt6ZFZ6UycuaGmbM= 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.14 88/89] l2t_seq_next should increase position index Date: Mon, 3 Feb 2020 16:20:13 +0000 Message-Id: <20200203161927.408284554@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200203161916.847439465@linuxfoundation.org> References: <20200203161916.847439465@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 66018a102f7756cf72db4d2704e1b93969d9d332 ] 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/l2t.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c index f7ef8871dd0b0..67aa3c9974173 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c +++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c @@ -682,8 +682,7 @@ static void *l2t_seq_start(struct seq_file *seq, loff_t *pos) static void *l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos) { v = l2t_get_idx(seq, *pos); - if (v) - ++*pos; + ++(*pos); return v; }