mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jeff Layton <jlayton@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>, NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: Re: [PATCH] nfsd: fix NULL pointer dereference in check_export()
Date: Sat, 17 Jan 2026 10:27:42 +0800	[thread overview]
Message-ID: <202601171021.4DQZyXiU-lkp@intel.com> (raw)
In-Reply-To: <20260116-nfsd-fixes-v1-1-019689b72747@kernel.org>

Hi Jeff,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 983d014aafb14ee5e4915465bf8948e8f3a723b5]

url:    https://github.com/intel-lab-lkp/linux/commits/Jeff-Layton/nfsd-fix-NULL-pointer-dereference-in-check_export/20260117-022519
base:   983d014aafb14ee5e4915465bf8948e8f3a723b5
patch link:    https://lore.kernel.org/r/20260116-nfsd-fixes-v1-1-019689b72747%40kernel.org
patch subject: [PATCH] nfsd: fix NULL pointer dereference in check_export()
config: parisc-defconfig (https://download.01.org/0day-ci/archive/20260117/202601171021.4DQZyXiU-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260117/202601171021.4DQZyXiU-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601171021.4DQZyXiU-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/nfsd/export.c: In function 'check_export':
>> fs/nfsd/export.c:408:47: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     408 |         struct export_operations *export_op = inode->i_sb->s_export_op;
         |                                               ^~~~~


vim +/const +408 fs/nfsd/export.c

   404	
   405	static int check_export(const struct path *path, int *flags, unsigned char *uuid)
   406	{
   407		struct inode *inode = d_inode(path->dentry);
 > 408		struct export_operations *export_op = inode->i_sb->s_export_op;
   409	
   410		/*
   411		 * We currently export only dirs, regular files, and (for v4
   412		 * pseudoroot) symlinks.
   413		 */
   414		if (!S_ISDIR(inode->i_mode) &&
   415		    !S_ISLNK(inode->i_mode) &&
   416		    !S_ISREG(inode->i_mode))
   417			return -ENOTDIR;
   418	
   419		/*
   420		 * Mountd should never pass down a writeable V4ROOT export, but,
   421		 * just to make sure:
   422		 */
   423		if (*flags & NFSEXP_V4ROOT)
   424			*flags |= NFSEXP_READONLY;
   425	
   426		/* There are four requirements on a filesystem to be exportable:
   427		 * 1: It must define sb->s_export_op
   428		 * 2: We must be able to identify the filesystem from a number.
   429		 *       either a device number (so FS_REQUIRES_DEV needed)
   430		 *       or an FSID number (so NFSEXP_FSID or ->uuid is needed).
   431		 * 3: We must be able to find an inode from a filehandle.
   432		 *       This means that s_export_op must be set.
   433		 * 4: We must not currently be on an idmapped mount.
   434		 */
   435		if (!export_op) {
   436			dprintk("%s: fs doesn't define export_operations!\n", __func__);
   437			return -EINVAL;
   438		}
   439	
   440		if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&
   441		    !(*flags & NFSEXP_FSID) &&
   442		    uuid == NULL) {
   443			dprintk("exp_export: export of non-dev fs without fsid\n");
   444			return -EINVAL;
   445		}
   446	
   447		if (!exportfs_can_decode_fh(export_op)) {
   448			dprintk("exp_export: export of invalid fs type.\n");
   449			return -EINVAL;
   450		}
   451	
   452		if (is_idmapped_mnt(path->mnt)) {
   453			dprintk("exp_export: export of idmapped mounts not yet supported.\n");
   454			return -EINVAL;
   455		}
   456	
   457		if (export_op->flags & EXPORT_OP_NOSUBTREECHK &&
   458		    !(*flags & NFSEXP_NOSUBTREECHECK)) {
   459			dprintk("%s: %s does not support subtree checking!\n",
   460				__func__, inode->i_sb->s_type->name);
   461			return -EINVAL;
   462		}
   463		return 0;
   464	}
   465	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2026-01-17  2:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16 18:22 Jeff Layton
2026-01-16 18:35 ` Jeff Layton
2026-01-17  2:27 ` kernel test robot [this message]
2026-01-17  4:03 ` kernel test robot

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=202601171021.4DQZyXiU-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=okorniev@redhat.com \
    --cc=tom@talpey.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®