From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF869C001DB for ; Fri, 25 Aug 2023 16:22:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343969AbjHYQVx (ORCPT ); Fri, 25 Aug 2023 12:21:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343988AbjHYQVa (ORCPT ); Fri, 25 Aug 2023 12:21:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1621FDB for ; Fri, 25 Aug 2023 09:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692980443; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=y+lRSs+hmNEjHVxY8rBJ0LoRMNpoMiYd+1+hxT28KB4=; b=WGAPh8Ooo7emIE04AISXX+QBfOkFdYkxwBriOs/jfZDJ5LaVGSkuC7egHqNYM5LaDy9bVd pXj6XRwFWRjSqiRX4dNsJ8tXEK+hwpiWHFEfpab9giwj6BORRXoiLOz++ln7D2wbvwMV75 XanJstgqYUhxBOpqd2bBPycG3YtJBGY= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-4q0Mfw-NM6K2XxspvmH6lw-1; Fri, 25 Aug 2023 12:20:38 -0400 X-MC-Unique: 4q0Mfw-NM6K2XxspvmH6lw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FDD11C02CB7; Fri, 25 Aug 2023 16:20:37 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.225.136]) by smtp.corp.redhat.com (Postfix) with SMTP id 25ACF6B2B6; Fri, 25 Aug 2023 16:20:34 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 25 Aug 2023 18:19:51 +0200 (CEST) Date: Fri, 25 Aug 2023 18:19:47 +0200 From: Oleg Nesterov To: Andrew Morton , Yonghong Song Cc: "Eric W. Biederman" , Linus Torvalds , Daniel Borkmann , Kui-Feng Lee , Andrii Nakryiko , Martin KaFai Lau , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] bpf: task_group_seq_get_next: fix the skip_if_dup_files check Message-ID: <20230825161947.GA16871@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230825161842.GA16750@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unless I am notally confused it is wrong. We are going to return or skip next_task so we need to check next_task-files, not task->files. Signed-off-by: Oleg Nesterov --- kernel/bpf/task_iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c index 1589ec3faded..2264870ae3fc 100644 --- a/kernel/bpf/task_iter.c +++ b/kernel/bpf/task_iter.c @@ -82,7 +82,7 @@ static struct task_struct *task_group_seq_get_next(struct bpf_iter_seq_task_comm common->pid_visiting = *tid; - if (skip_if_dup_files && task->files == task->group_leader->files) { + if (skip_if_dup_files && next_task->files == next_task->group_leader->files) { task = next_task; goto retry; } -- 2.25.1.362.g51ebf55