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 2B194C433EF for ; Fri, 22 Jul 2022 17:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236226AbiGVRtM (ORCPT ); Fri, 22 Jul 2022 13:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235683AbiGVRtA (ORCPT ); Fri, 22 Jul 2022 13:49:00 -0400 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C180A99675 for ; Fri, 22 Jul 2022 10:48:51 -0700 (PDT) Received: by mail-pf1-x449.google.com with SMTP id e21-20020aa78c55000000b00528c6cca624so2139790pfd.3 for ; Fri, 22 Jul 2022 10:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DhjjSNuficgbRYAqqQ0W8XZGDABdrTHUp2H4nxtLaug=; b=UaSyoQoWOe59gEz2lV5iSdd4Xui68GIh6hAoQ3sXlaZ9lYziZzxJvwsR7TEv6NAokv Sn59n3tVFUsogki/DpXQSjv45PjR7KBr7ti3sKFj1mFcc7P6nFgVEtcK6iSm0RYItD6M rDjG5b/S24r7Uez1UAh6PRJcsZONVBjq4Gqs362SjaKNhEZNudJPq3/eXj7QKbR5LkZa dFSN25KbgRHCAKTyHak9TQqwz5SXaXPbjI+aF0Ku+oV+SZGpP0Zu08rHWA3mU1Vh8iiI LWaXOnJ0ieD04JU6IrzvzlTHGnWgdgsstD8/qkRiB06i1TI2MT3MGUYWvlai/fc9u6IS 2MWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DhjjSNuficgbRYAqqQ0W8XZGDABdrTHUp2H4nxtLaug=; b=cmJVOlnWVVbwy6Qvifa/lLVIv7oBFxgATpGcrKiEke62aDEPoIaqnMgnyRe3KI4cyG YJXGqg0PxuiCd6aNkA9biYbSplC8t//rX5CveDagEq9dhMATmZ8Stnvp0djr1W0CMH0Z YdMukPEXepoxCCr/HOC6k3WnJF5gu27byCdEGEo/upf0vW08YdIoVD2PwVfdAa8Y24+R 0WDt36/QjtEpMSRD8x2pUaxAC6YKR+3K7Dlaq03oFsmLjUihw+RoYPphjfrM+omhsj25 uDz7qN25Ixle3quSfxmbYiJXQBXL6VDP+lhl9Z3UHki2HbRWcHu+J+Ue5Tzp4dGt+AcJ KuXQ== X-Gm-Message-State: AJIora/nwyovgPMkjS4KAZ3BcFvGBDmNLAwHCTsf6rN7QXtFreL2TlfC JyAI1cdcF40LWMZ2xENlUyN6hzD3uzi1O206 X-Google-Smtp-Source: AGRyM1vfG4k83dD4ZmpzMaHGOmUCxNQqE4VrQcU1BJMMbLD5EP1RXFYs48/aOKdOMxJ39iP8pTDTa9o06EiBppcZ X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:2327]) (user=yosryahmed job=sendgmr) by 2002:a17:90a:249:b0:1e0:a8a3:3c6c with SMTP id t9-20020a17090a024900b001e0a8a33c6cmr1072620pje.0.1658512130666; Fri, 22 Jul 2022 10:48:50 -0700 (PDT) Date: Fri, 22 Jul 2022 17:48:23 +0000 In-Reply-To: <20220722174829.3422466-1-yosryahmed@google.com> Message-Id: <20220722174829.3422466-3-yosryahmed@google.com> Mime-Version: 1.0 References: <20220722174829.3422466-1-yosryahmed@google.com> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog Subject: [PATCH bpf-next v5 2/8] cgroup: enable cgroup_get_from_file() on cgroup1 From: Yosry Ahmed To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , Hao Luo , Tejun Heo , Zefan Li Cc: Johannes Weiner , Shuah Khan , Michal Hocko , KP Singh , Benjamin Tissoires , John Fastabend , "=?UTF-8?q?Michal=20Koutn=C3=BD?=" , Roman Gushchin , David Rientjes , Stanislav Fomichev , Greg Thelen , Shakeel Butt , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, cgroups@vger.kernel.org, Yosry Ahmed Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cgroup_get_from_file() currently fails with -EBADF if called on cgroup v1. However, the current implementation works on cgroup v1 as well, so the restriction is unnecessary. This enabled cgroup_get_from_fd() to work on cgroup v1, which would be the only thing stopping bpf cgroup_iter from supporting cgroup v1. Signed-off-by: Yosry Ahmed --- kernel/cgroup/cgroup.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 1779ccddb734..9943fcb1e574 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6090,11 +6090,6 @@ static struct cgroup *cgroup_get_from_file(struct file *f) return ERR_CAST(css); cgrp = css->cgroup; - if (!cgroup_on_dfl(cgrp)) { - cgroup_put(cgrp); - return ERR_PTR(-EBADF); - } - return cgrp; } -- 2.37.1.359.gd136c6c3e2-goog