From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1F0051993B; Wed, 30 Sep 2026 17:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790790097; cv=none; b=BMpAxL5PNqDUrUS7MQekl7+uvKqwvHV0ilHAR0OA7DxkO20+9n8EtfWD3q4pABhsSPQya6U4BcY467ojgqqK4P1nwtWvV6I+r7GIrgq6aD2BE1+xzv86zqi+YxVvKwVdnH5/vT2rXt9uP8qZWG1JB8XoJd1HfhYD+02KJ+Akspc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790790097; c=relaxed/simple; bh=xm7ow3ZUCYdzSQGNQ8ypPePp5ofR99/SLoLoWG3Sg8E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FYOCNo0gzAjAL4UvszyPh2i9ACdV9iUxPseFw2IGhkPlWkj1DYFoQREjLMDYJkNq+xsUS9wpHzZ1GjML4Gzyd3KybrC7JfZQrtHZuPx+4sbJHg1164uuduoOB3COnRzLbb03lYxeGLSx97zZ+PVCSLVOF6ZYgmyZMEtiQj1rTro= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=v8r5llpF; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="v8r5llpF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57EF31F000FF; Wed, 30 Sep 2026 17:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790790095; bh=/76Fn+SC0rDikE1qvbrCQfHQywU2Kt5//IcfHHlH17M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=v8r5llpFgKkij7SfybxswDZ4OO+4ZUAN2V91OfYHvYW6C6XQDrswHLEYPhVku70Ac /x2yiHFBP3BbcXFRlTpD8VohUzZ2PqLfrYhEFNKEMVVuOsW82Ki6/ufi/QZlvamucs 9QnEpE0thT8Wfat+EH841q3QGqR9SMSKlAfnynlA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jan Kara , Christian Brauner , Al Viro , Sasha Levin Subject: [PATCH 6.12 709/877] configfs:get_target() - release path as soon as we grab configfs_item reference Date: Wed, 30 Sep 2026 17:27:00 +0200 Message-ID: <20260930152429.983292368@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152414.738996857@linuxfoundation.org> References: <20260930152414.738996857@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Al Viro [ Upstream commit 1b25dea3867abc9bad6f0337d395c6f0ce4e4f6f ] ... and get rid of path argument - it turns into a local variable in get_target() Reviewed-by: Jan Kara Reviewed-by: Christian Brauner Signed-off-by: Al Viro Stable-dep-of: a7c1290eef60 ("configfs: pin the symlink target's dirent instead of chasing ->ci_dentry") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/configfs/symlink.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c @@ -114,26 +114,21 @@ static int create_link(struct config_ite } -static int get_target(const char *symname, struct path *path, - struct config_item **target, struct super_block *sb) +static int get_target(const char *symname, struct config_item **target, + struct super_block *sb) { + struct path path __free(path_put) = {}; int ret; - ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path); - if (!ret) { - if (path->dentry->d_sb == sb) { - *target = configfs_get_config_item(path->dentry); - if (!*target) { - ret = -ENOENT; - path_put(path); - } - } else { - ret = -EPERM; - path_put(path); - } - } - - return ret; + ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &path); + if (ret) + return ret; + if (path.dentry->d_sb != sb) + return -EPERM; + *target = configfs_get_config_item(path.dentry); + if (!*target) + return -ENOENT; + return 0; } @@ -141,7 +136,6 @@ int configfs_symlink(struct mnt_idmap *i struct dentry *dentry, const char *symname) { int ret; - struct path path; struct configfs_dirent *sd; struct config_item *parent_item; struct config_item *target_item = NULL; @@ -188,7 +182,7 @@ int configfs_symlink(struct mnt_idmap *i * AV, a thoroughly annoyed bastard. */ inode_unlock(dir); - ret = get_target(symname, &path, &target_item, dentry->d_sb); + ret = get_target(symname, &target_item, dentry->d_sb); inode_lock(dir); if (ret) goto out_put; @@ -210,7 +204,6 @@ int configfs_symlink(struct mnt_idmap *i } config_item_put(target_item); - path_put(&path); out_put: config_item_put(parent_item);