From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [brauner-vfs:vfs.fixes 30/31] fs/afs/symlink.c:130 afs_do_read_symlink() error: we previously assumed 'vnode->directory' could be null (see line 96)
Date: Fri, 15 May 2026 03:37:18 +0800 [thread overview]
Message-ID: <202605150307.KNKEp1AH-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Christian Brauner <christianvanbrauner@gmail.com>
TO: David Howells <dhowells@redhat.com>
CC: Christian Brauner <brauner@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.fixes
head: 45205929a3a3310e4978f4097d8ed4fca36b2c32
commit: c0410adf3da6db46f3513411fcf95e63c2f1d1ad [30/31] afs: Fix the locking used by afs_get_link()
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-r073-20260514 (https://download.01.org/0day-ci/archive/20260515/202605150307.KNKEp1AH-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9185-gbcc58b9c
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202605150307.KNKEp1AH-lkp@intel.com/
smatch warnings:
fs/afs/symlink.c:130 afs_do_read_symlink() error: we previously assumed 'vnode->directory' could be null (see line 96)
vim +130 fs/afs/symlink.c
c0410adf3da6db4 David Howells 2026-05-12 79
c0410adf3da6db4 David Howells 2026-05-12 80 /*
c0410adf3da6db4 David Howells 2026-05-12 81 * Read a symlink in a single download.
c0410adf3da6db4 David Howells 2026-05-12 82 */
c0410adf3da6db4 David Howells 2026-05-12 83 static ssize_t afs_do_read_symlink(struct afs_vnode *vnode)
c0410adf3da6db4 David Howells 2026-05-12 84 {
c0410adf3da6db4 David Howells 2026-05-12 85 struct afs_symlink *symlink;
c0410adf3da6db4 David Howells 2026-05-12 86 struct iov_iter iter;
c0410adf3da6db4 David Howells 2026-05-12 87 ssize_t ret;
c0410adf3da6db4 David Howells 2026-05-12 88 loff_t i_size;
c0410adf3da6db4 David Howells 2026-05-12 89
c0410adf3da6db4 David Howells 2026-05-12 90 i_size = i_size_read(&vnode->netfs.inode);
c0410adf3da6db4 David Howells 2026-05-12 91 if (i_size > PAGE_SIZE - 1) {
c0410adf3da6db4 David Howells 2026-05-12 92 trace_afs_file_error(vnode, -EFBIG, afs_file_error_dir_big);
c0410adf3da6db4 David Howells 2026-05-12 93 return -EFBIG;
c0410adf3da6db4 David Howells 2026-05-12 94 }
c0410adf3da6db4 David Howells 2026-05-12 95
c0410adf3da6db4 David Howells 2026-05-12 @96 if (!vnode->directory) {
c0410adf3da6db4 David Howells 2026-05-12 97 size_t cur_size = 0;
c0410adf3da6db4 David Howells 2026-05-12 98
c0410adf3da6db4 David Howells 2026-05-12 99 ret = netfs_alloc_folioq_buffer(NULL,
c0410adf3da6db4 David Howells 2026-05-12 100 &vnode->directory, &cur_size, PAGE_SIZE,
c0410adf3da6db4 David Howells 2026-05-12 101 mapping_gfp_mask(vnode->netfs.inode.i_mapping));
c0410adf3da6db4 David Howells 2026-05-12 102 vnode->directory_size = PAGE_SIZE - 1;
c0410adf3da6db4 David Howells 2026-05-12 103 if (ret < 0)
c0410adf3da6db4 David Howells 2026-05-12 104 return ret;
c0410adf3da6db4 David Howells 2026-05-12 105 }
c0410adf3da6db4 David Howells 2026-05-12 106
c0410adf3da6db4 David Howells 2026-05-12 107 iov_iter_folio_queue(&iter, ITER_DEST, vnode->directory, 0, 0, PAGE_SIZE);
c0410adf3da6db4 David Howells 2026-05-12 108
c0410adf3da6db4 David Howells 2026-05-12 109 /* AFS requires us to perform the read of a symlink as a single unit to
c0410adf3da6db4 David Howells 2026-05-12 110 * avoid issues with the content being changed between reads.
c0410adf3da6db4 David Howells 2026-05-12 111 */
c0410adf3da6db4 David Howells 2026-05-12 112 ret = netfs_read_single(&vnode->netfs.inode, NULL, &iter);
c0410adf3da6db4 David Howells 2026-05-12 113 if (ret >= 0) {
c0410adf3da6db4 David Howells 2026-05-12 114 i_size = ret;
c0410adf3da6db4 David Howells 2026-05-12 115 if (i_size > PAGE_SIZE - 1) {
c0410adf3da6db4 David Howells 2026-05-12 116 trace_afs_file_error(vnode, -EFBIG, afs_file_error_dir_big);
c0410adf3da6db4 David Howells 2026-05-12 117 return -EFBIG;
c0410adf3da6db4 David Howells 2026-05-12 118 }
c0410adf3da6db4 David Howells 2026-05-12 119 vnode->directory_size = i_size;
c0410adf3da6db4 David Howells 2026-05-12 120
c0410adf3da6db4 David Howells 2026-05-12 121 /* Copy the symlink. */
c0410adf3da6db4 David Howells 2026-05-12 122 symlink = kmalloc_flex(struct afs_symlink, content, i_size + 1,
c0410adf3da6db4 David Howells 2026-05-12 123 GFP_KERNEL);
c0410adf3da6db4 David Howells 2026-05-12 124 if (!symlink)
c0410adf3da6db4 David Howells 2026-05-12 125 return -ENOMEM;
c0410adf3da6db4 David Howells 2026-05-12 126
c0410adf3da6db4 David Howells 2026-05-12 127 refcount_set(&symlink->ref, 1);
c0410adf3da6db4 David Howells 2026-05-12 128 symlink->content[i_size] = 0;
c0410adf3da6db4 David Howells 2026-05-12 129
c0410adf3da6db4 David Howells 2026-05-12 @130 const char *s = kmap_local_folio(folioq_folio(vnode->directory, 0), 0);
c0410adf3da6db4 David Howells 2026-05-12 131
c0410adf3da6db4 David Howells 2026-05-12 132 memcpy(symlink->content, s, i_size);
c0410adf3da6db4 David Howells 2026-05-12 133 kunmap_local(s);
c0410adf3da6db4 David Howells 2026-05-12 134
c0410adf3da6db4 David Howells 2026-05-12 135 afs_replace_symlink(vnode, symlink);
c0410adf3da6db4 David Howells 2026-05-12 136 }
c0410adf3da6db4 David Howells 2026-05-12 137
c0410adf3da6db4 David Howells 2026-05-12 138 if (!fscache_cookie_enabled(netfs_i_cookie(&vnode->netfs))) {
c0410adf3da6db4 David Howells 2026-05-12 139 netfs_free_folioq_buffer(vnode->directory);
c0410adf3da6db4 David Howells 2026-05-12 140 vnode->directory = NULL;
c0410adf3da6db4 David Howells 2026-05-12 141 vnode->directory_size = 0;
c0410adf3da6db4 David Howells 2026-05-12 142 }
c0410adf3da6db4 David Howells 2026-05-12 143
c0410adf3da6db4 David Howells 2026-05-12 144 return ret;
c0410adf3da6db4 David Howells 2026-05-12 145 }
c0410adf3da6db4 David Howells 2026-05-12 146
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-05-14 19:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202605150307.KNKEp1AH-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.