From nobody Fri Nov 29 22:00:53 2024 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F66F13342F for ; Sat, 14 Sep 2024 09:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726307819; cv=none; b=bFVgkOECdyE48ftZ/sX3TVmJ/I/sZr5Ao8G+JnsJYJEma5MjNw0Em8ADvnrEdpBgASZCa3SUQltnE81K1XdbxWDgvkluR2bR5ItU8m2XykzDc2C08K5Ax16yU6nVxiYKzD6dJM2WG382OciToD3zvdIYkdZtZM/DtcoUhETeKe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726307819; c=relaxed/simple; bh=5/7xNgVMM5znzPlTwRdQPzrcGDt5NrLxOnLVL5Ox/kE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=rQS4CazSs+ySWvqKEdhTU/JqDWN4FrRaMKaU/ZpfZAuG5LoB7p65jDUbp27y1mKZGr+ky7RQh95LgUnHufn+CW1pCdvW2tcDTNjo6Oro4FCCKPuLtiTmLbJLQ9ETnm3RxsJUBzgL6JLCqTgr+w7yq6b/0ueSvPPsL1Mb5hFicRM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R8cWZ7F+; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R8cWZ7F+" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5c42bda005eso434045a12.0 for ; Sat, 14 Sep 2024 02:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726307816; x=1726912616; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=ZkttiUwbZSAhIQr2HB1QpBV3Ynk91TOIcc4nZQ4D7J4=; b=R8cWZ7F+VkvG5LxQGnbvRBxjNNGZwgSTiNCot7EAtRn3NT/CSfYnsNtRFDVthzLLXN yL7OCrKefDQJUmXORQqDJjhS/v4pPiKFNQ6neWpCVfDa1eOPTMilUtPMGJi8EzWyMMpN lkm355sn2DXTtYM0eTOcFraoP6Pw0a9597NreMz4Ea1B5qPqkHJzrLCW0Jb14ehbWeOO LDG8l2sZtlyWPpqGVw9JhLdjzVug944wE6EywV1Uc4Jjxv/FdaBDt5Yin+Bh1damXJcV AZ0cb22/ssFmhWTx018g1ByrGaaFYWcXm2SKRUOC6dwayKqrNVnhlsetb9k8b4PDZJUR iU5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726307816; x=1726912616; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZkttiUwbZSAhIQr2HB1QpBV3Ynk91TOIcc4nZQ4D7J4=; b=dYBYcmeTfsdfqb8dMKVA6NSoJyaq+fpjTv+HMSENGRw6Q9pYnw2iPUisd8HSDDII5r V5avmkpYH3JrRy80d5gs/TIOZgO74NwstxFhV/fU6D+vV5LO+PnJ18A8fK4Dv8+46Rkf JXSRf/8qHnSC5DPp1vTsG1QzdceiAz8Zzwxsw1zB2O8v+34LXAzl0B3aRqmfM4lwpLyb 1kyq4EYYLMJDZ5GEsJszXDPDlwCD8TeqPyiwGoJ3+pp0ewJq6G3MLG1pTa1FVC9Nj3as J2mLCAMj+IdHnBEgoO6LKoUvFYIE1KkqR52HzUtbzSbBkOKkdXMOC38v920xAXhIjLg3 zP5w== X-Forwarded-Encrypted: i=1; AJvYcCWr+MQbxtLwmD/FflLqp73yJCMJSBACzTZKOxxtHyDh4TST33ft1+5xhl+WTW+k0Zxu4TmCS9hDmwteBJ4=@vger.kernel.org X-Gm-Message-State: AOJu0YySStjzTE45z9p/oISecMIcY4w5fR+eXwfyJ5apm2lgjKtPzzvl 8O0GK9EMXorTuNKyEDrlTkG9FGL/6HI5qMOxkIf7I8jwle0pqpKjRkVwOFh3rpo= X-Google-Smtp-Source: AGHT+IHW72oX7a7JyqQYEvWLyhwpREGh2KNn57UUT6JYrRYTabD7lJwM/On03q66LCo0gYCNv4awyg== X-Received: by 2002:a05:6402:5108:b0:5c3:2440:856f with SMTP id 4fb4d7f45d1cf-5c413e4bd3fmr6660928a12.27.1726307815533; Sat, 14 Sep 2024 02:56:55 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c42bc88d82sm497729a12.81.2024.09.14.02.56.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 Sep 2024 02:56:54 -0700 (PDT) Date: Sat, 14 Sep 2024 12:56:51 +0300 From: Dan Carpenter To: Florian Westphal Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net] netfilter: nft_socket: Fix a NULL vs IS_ERR() bug in nft_socket_cgroup_subtree_level() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The cgroup_get_from_path() function never returns NULL, it returns error pointers. Update the error handling to match. Fixes: 7f3287db6543 ("netfilter: nft_socket: make cgroupsv2 matching work w= ith namespaces") Signed-off-by: Dan Carpenter Acked-by: Florian Westphal Acked-by: Pablo Neira Ayuso --- net/netfilter/nft_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c index ac3c9e9cf0f3..f5da0c1775f2 100644 --- a/net/netfilter/nft_socket.c +++ b/net/netfilter/nft_socket.c @@ -61,8 +61,8 @@ static noinline int nft_socket_cgroup_subtree_level(void) struct cgroup *cgrp =3D cgroup_get_from_path("/"); int level; =20 - if (!cgrp) - return -ENOENT; + if (IS_ERR(cgrp)) + return PTR_ERR(cgrp); =20 level =3D cgrp->level; =20 --=20 2.45.2