All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cifs: Fix leak when handling lease break for cached root fid
@ 2020-06-30  2:30 Paul Aurich
  2020-07-01 13:13 ` Aurélien Aptel
  2020-07-02  0:53 ` Steve French
  0 siblings, 2 replies; 5+ messages in thread
From: Paul Aurich @ 2020-06-30  2:30 UTC (permalink / raw)
  To: linux-cifs, sfrench; +Cc: paul, Ronnie Sahlberg, Aurélien Aptel

Handling a lease break for the cached root didn't free the
smb2_lease_break_work allocation, resulting in a leak:

    unreferenced object 0xffff98383a5af480 (size 128):
      comm "cifsd", pid 684, jiffies 4294936606 (age 534.868s)
      hex dump (first 32 bytes):
        c0 ff ff ff 1f 00 00 00 88 f4 5a 3a 38 98 ff ff  ..........Z:8...
        88 f4 5a 3a 38 98 ff ff 80 88 d6 8a ff ff ff ff  ..Z:8...........
      backtrace:
        [<0000000068957336>] smb2_is_valid_oplock_break+0x1fa/0x8c0
        [<0000000073b70b9e>] cifs_demultiplex_thread+0x73d/0xcc0
        [<00000000905fa372>] kthread+0x11c/0x150
        [<0000000079378e4e>] ret_from_fork+0x22/0x30

Avoid this leak by only allocating when necessary.

Fixes: a93864d93977 ("cifs: add lease tracking to the cached root fid")
Signed-off-by: Paul Aurich <paul@darkrain42.org>
CC: Stable <stable@vger.kernel.org> # v4.18+
---
 fs/cifs/smb2misc.c | 47 ++++++++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 20 deletions(-)

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 6a39451973f8..570c0521fc3c 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -505,8 +505,7 @@ cifs_ses_oplock_break(struct work_struct *work)
 }
 
 static bool
-smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
-		    struct smb2_lease_break_work *lw)
+smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
 {
 	bool found;
 	__u8 lease_state;
@@ -516,9 +515,13 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
 	struct cifsInodeInfo *cinode;
 	int ack_req = le32_to_cpu(rsp->Flags &
 				  SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED);
+	struct smb2_lease_break_work *lw;
+	struct tcon_link *tlink;
+	__u8 lease_key[SMB2_LEASE_KEY_SIZE];
 
 	lease_state = le32_to_cpu(rsp->NewLeaseState);
 
+	spin_lock(&tcon->open_file_lock);
 	list_for_each(tmp, &tcon->openFileList) {
 		cfile = list_entry(tmp, struct cifsFileInfo, tlist);
 		cinode = CIFS_I(d_inode(cfile->dentry));
@@ -542,7 +545,8 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
 		cfile->oplock_level = lease_state;
 
 		cifs_queue_oplock_break(cfile);
-		kfree(lw);
+		spin_unlock(&tcon->open_file_lock);
+		spin_unlock(&cifs_tcp_ses_lock);
 		return true;
 	}
 
@@ -554,10 +558,9 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
 
 		if (!found && ack_req) {
 			found = true;
-			memcpy(lw->lease_key, open->lease_key,
+			memcpy(lease_key, open->lease_key,
 			       SMB2_LEASE_KEY_SIZE);
-			lw->tlink = cifs_get_tlink(open->tlink);
-			queue_work(cifsiod_wq, &lw->lease_break);
+			tlink = cifs_get_tlink(open->tlink);
 		}
 
 		cifs_dbg(FYI, "found in the pending open list\n");
@@ -567,6 +570,23 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
 		open->oplock = lease_state;
 	}
 
+	spin_unlock(&tcon->open_file_lock);
+	if (found) {
+		spin_unlock(&cifs_tcp_ses_lock);
+
+		lw = kmalloc(sizeof(struct smb2_lease_break_work), GFP_KERNEL);
+		if (!lw) {
+			cifs_put_tlink(tlink);
+			return true;
+		}
+
+		INIT_WORK(&lw->lease_break, cifs_ses_oplock_break);
+		lw->tlink = tlink;
+		lw->lease_state = rsp->NewLeaseState;
+		memcpy(lw->lease_key, lease_key, SMB2_LEASE_KEY_SIZE);
+		queue_work(cifsiod_wq, &lw->lease_break);
+	}
+
 	return found;
 }
 
@@ -578,14 +598,6 @@ smb2_is_valid_lease_break(char *buffer)
 	struct TCP_Server_Info *server;
 	struct cifs_ses *ses;
 	struct cifs_tcon *tcon;
-	struct smb2_lease_break_work *lw;
-
-	lw = kmalloc(sizeof(struct smb2_lease_break_work), GFP_KERNEL);
-	if (!lw)
-		return false;
-
-	INIT_WORK(&lw->lease_break, cifs_ses_oplock_break);
-	lw->lease_state = rsp->NewLeaseState;
 
 	cifs_dbg(FYI, "Checking for lease break\n");
 
@@ -600,15 +612,11 @@ smb2_is_valid_lease_break(char *buffer)
 			list_for_each(tmp2, &ses->tcon_list) {
 				tcon = list_entry(tmp2, struct cifs_tcon,
 						  tcon_list);
-				spin_lock(&tcon->open_file_lock);
 				cifs_stats_inc(
 				    &tcon->stats.cifs_stats.num_oplock_brks);
-				if (smb2_tcon_has_lease(tcon, rsp, lw)) {
-					spin_unlock(&tcon->open_file_lock);
-					spin_unlock(&cifs_tcp_ses_lock);
+				if (smb2_tcon_has_lease(tcon, rsp)) {
 					return true;
 				}
-				spin_unlock(&tcon->open_file_lock);
 
 				if (tcon->crfid.is_valid &&
 				    !memcmp(rsp->LeaseKey,
@@ -625,7 +633,6 @@ smb2_is_valid_lease_break(char *buffer)
 		}
 	}
 	spin_unlock(&cifs_tcp_ses_lock);
-	kfree(lw);
 	cifs_dbg(FYI, "Can not process lease break - no lease matched\n");
 	return false;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH v2] cifs: Fix leak when handling lease break for cached root fid
@ 2020-06-30  7:34 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-06-30  7:34 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 60738 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200630023003.1858066-1-paul@darkrain42.org>
References: <20200630023003.1858066-1-paul@darkrain42.org>
TO: Paul Aurich <paul@darkrain42.org>

Hi Paul,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc3 next-20200629]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Paul-Aurich/cifs-Fix-leak-when-handling-lease-break-for-cached-root-fid/20200630-103420
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: sparc-randconfig-s031-20200630 (attached as .config)
compiler: sparc-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-3-gfa153962-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C= CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sparc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

         |     ^~~~~~~~~~~~~~~
   fs/cifs/ioctl.c: In function 'cifs_ioctl':
   fs/cifs/ioctl.c:174:10: warning: variable 'caps' set but not used [-Wunused-but-set-variable]
     174 |  __u64   caps;
         |          ^~~~
   In file included from fs/btrfs/zstd.c:19:
   include/linux/zstd.h:798:21: warning: 'ZSTD_skippableHeaderSize' defined but not used [-Wunused-const-variable=]
     798 | static const size_t ZSTD_skippableHeaderSize = 8;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:796:21: warning: 'ZSTD_frameHeaderSize_max' defined but not used [-Wunused-const-variable=]
     796 | static const size_t ZSTD_frameHeaderSize_max = ZSTD_FRAMEHEADERSIZE_MAX;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:795:21: warning: 'ZSTD_frameHeaderSize_min' defined but not used [-Wunused-const-variable=]
     795 | static const size_t ZSTD_frameHeaderSize_min = ZSTD_FRAMEHEADERSIZE_MIN;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:794:21: warning: 'ZSTD_frameHeaderSize_prefix' defined but not used [-Wunused-const-variable=]
     794 | static const size_t ZSTD_frameHeaderSize_prefix = 5;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rculist_bl.h:24:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
   In file included from fs/btrfs/compression.c:22:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/signalfd.c:66:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected struct wait_queue_head [usertype] *wait_address @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:66:33: sparse:     expected struct wait_queue_head [usertype] *wait_address
   fs/signalfd.c:66:33: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:68:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:68:31: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:68:31: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:73:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:73:33: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:73:33: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:108:32: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:125:33: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:131:33: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:150:32: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:154:38: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:172:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:172:31: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:172:31: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:181:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:181:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:181:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:185:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:185:32: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:185:32: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:195:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:195:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:195:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:197:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:197:39: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:197:39: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:199:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:199:33: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:199:33: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:201:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:201:35: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:201:35: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:301:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:301:39: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:301:39: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:303:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:303:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:303:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:305:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:305:17: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:305:17: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'tree' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'offset' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'next_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'prev_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'p_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'parent_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'tree' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'start' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'start_ret' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'end_ret' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'bits' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'tree' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'start' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'start_ret' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'end_ret' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'bits' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:4152: warning: Function parameter or member 'epd' not described in 'extent_write_cache_pages'
   fs/btrfs/extent_io.c:4152: warning: Excess function parameter 'data' description in 'extent_write_cache_pages'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'root' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'inode' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'ctl' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'block_group' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'io_ctl' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'trans' not described in '__btrfs_write_out_cache'
   fs/cifs/smb2misc.c:630:47: sparse: sparse: undefined identifier 'lw'
>> fs/cifs/smb2misc.c:542:24: sparse: sparse: context imbalance in 'smb2_tcon_has_lease' - unexpected unlock
>> fs/cifs/smb2misc.c:594:1: sparse: sparse: context imbalance in 'smb2_is_valid_lease_break' - wrong count at exit
   fs/cifs/smb2misc.c: In function 'smb2_is_valid_lease_break':
   fs/cifs/smb2misc.c:630:12: error: 'lw' undeclared (first use in this function)
     630 |      kfree(lw);
         |            ^~
   fs/cifs/smb2misc.c:630:12: note: each undeclared identifier is reported only once for each function it appears in
   make[3]: *** [scripts/Makefile.build:281: fs/cifs/smb2misc.o] Error 1
   fs/gfs2/inode.c:297: warning: Function parameter or member 'dir' not described in 'gfs2_lookupi'
   fs/gfs2/inode.c:297: warning: Excess function parameter 'd_gh' description in 'gfs2_lookupi'
   fs/gfs2/inode.c:297: warning: Excess function parameter 'i_gh' description in 'gfs2_lookupi'
   fs/gfs2/inode.c:478: warning: Excess function parameter 'bhp' description in 'init_dinode'
   fs/gfs2/inode.c:599: warning: Function parameter or member 'excl' not described in 'gfs2_create_inode'
   fs/gfs2/inode.c:845: warning: Function parameter or member 'excl' not described in 'gfs2_create'
   fs/gfs2/inode.c:1089: warning: Function parameter or member 'dentry' not described in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1089: warning: Excess function parameter 'name' description in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1089: warning: Excess function parameter 'inode' description in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1834: warning: Excess function parameter 'flags' description in 'gfs2_permission'
   fs/gfs2/inode.c:1875: warning: Function parameter or member 'inode' not described in 'gfs2_setattr_simple'
   In file included from fs/btrfs/delayed-ref.c:9:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/gfs2/recovery.c:165: warning: Function parameter or member 'head' not described in 'get_log_header'
   fs/gfs2/recovery.c:165: warning: Excess function parameter 'lh' description in 'get_log_header'
   fs/gfs2/recovery.c:195: warning: Function parameter or member 'pass' not described in 'foreach_descriptor'
   fs/btrfs/delayed-ref.c:80: warning: Function parameter or member 'fs_info' not described in 'btrfs_delayed_refs_rsv_release'
   fs/btrfs/delayed-ref.c:80: warning: Function parameter or member 'nr' not described in 'btrfs_delayed_refs_rsv_release'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'fs_info' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'src' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'num_bytes' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:174: warning: Function parameter or member 'fs_info' not described in 'btrfs_delayed_refs_rsv_refill'
   fs/btrfs/delayed-ref.c:174: warning: Function parameter or member 'flush' not described in 'btrfs_delayed_refs_rsv_refill'
   fs/eventpoll.c:1131: warning: Function parameter or member 'new' not described in 'list_add_tail_lockless'
   fs/eventpoll.c:1131: warning: Function parameter or member 'head' not described in 'list_add_tail_lockless'
   fs/eventpoll.c:1171: warning: Function parameter or member 'epi' not described in 'chain_epi_lockless'
   fs/btrfs/inode.c:2953: warning: Function parameter or member 'fs_info' not described in 'btrfs_wait_on_delayed_iputs'
   In file included from fs/btrfs/relocation.c:13:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/xfs/xfs_extent_busy.c:572:33: sparse: sparse: context imbalance in 'xfs_extent_busy_clear' - unexpected unlock
   fs/io_uring.c:2350:24: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void [noderef] __user * @@     got struct io_buffer *[assigned] kbuf @@
   fs/io_uring.c:2350:24: sparse:     expected void [noderef] __user *
   fs/io_uring.c:2350:24: sparse:     got struct io_buffer *[assigned] kbuf
   fs/io_uring.c:2518:40: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void [noderef] __user *[assigned] iov_base @@     got void * @@
   fs/io_uring.c:2518:40: sparse:     expected void [noderef] __user *[assigned] iov_base
   fs/io_uring.c:2518:40: sparse:     got void *
   fs/io_uring.c:2901:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected long long [noderef] [usertype] __user *off_in @@     got long long [usertype] *[assigned] poff_in @@
   fs/io_uring.c:2901:37: sparse:     expected long long [noderef] [usertype] __user *off_in
   fs/io_uring.c:2901:37: sparse:     got long long [usertype] *[assigned] poff_in
   fs/io_uring.c:2901:51: sparse: sparse: incorrect type in argument 4 (different address spaces) @@     expected long long [noderef] [usertype] __user *off_out @@     got long long [usertype] *[assigned] poff_out @@
   fs/io_uring.c:2901:51: sparse:     expected long long [noderef] [usertype] __user *off_out
   fs/io_uring.c:2901:51: sparse:     got long long [usertype] *[assigned] poff_out
   fs/io_uring.c:4085:72: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [usertype] mask @@
   fs/io_uring.c:4085:72: sparse:     expected int mask
   fs/io_uring.c:4085:72: sparse:     got restricted __poll_t [usertype] mask
   fs/io_uring.c:4090:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] result @@     got restricted __poll_t [usertype] mask @@
   fs/io_uring.c:4090:21: sparse:     expected unsigned int [usertype] result
   fs/io_uring.c:4090:21: sparse:     got restricted __poll_t [usertype] mask
   fs/io_uring.c:4116:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] result @@     got restricted __poll_t @@
   fs/io_uring.c:4116:29: sparse:     expected unsigned int [usertype] result
   fs/io_uring.c:4116:29: sparse:     got restricted __poll_t
   fs/io_uring.c:4166:34: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __poll_t [usertype] mask @@     got unsigned int [usertype] result @@
   fs/io_uring.c:4166:34: sparse:     expected restricted __poll_t [usertype] mask
   fs/io_uring.c:4166:34: sparse:     got unsigned int [usertype] result
   fs/io_uring.c:4344:41: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [usertype] @@
   fs/io_uring.c:4344:41: sparse:     expected int mask
   fs/io_uring.c:4344:41: sparse:     got restricted __poll_t [usertype]
   fs/io_uring.c:4429:22: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4429:22: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4429:22: sparse:    right side has type int
   fs/io_uring.c:4431:22: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4431:22: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4431:22: sparse:    right side has type int
   fs/io_uring.c:4432:14: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4432:14: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4432:14: sparse:    right side has type int
   fs/io_uring.c:4450:67: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [assigned] [usertype] mask @@
   fs/io_uring.c:4450:67: sparse:     expected int mask
   fs/io_uring.c:4450:67: sparse:     got restricted __poll_t [assigned] [usertype] mask
   fs/io_uring.c:4451:52: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected int events @@     got restricted __poll_t [usertype] events @@
   fs/io_uring.c:4451:52: sparse:     expected int events
   fs/io_uring.c:4451:52: sparse:     got restricted __poll_t [usertype] events
   fs/btrfs/scrub.c:1180:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:1189:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:703:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:717:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:775:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:2136:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string *
--
         |     ^~~~~~~~~~~~~~~
   fs/cifs/ioctl.c: In function 'cifs_ioctl':
   fs/cifs/ioctl.c:174:10: warning: variable 'caps' set but not used [-Wunused-but-set-variable]
     174 |  __u64   caps;
         |          ^~~~
   In file included from fs/btrfs/zstd.c:19:
   include/linux/zstd.h:798:21: warning: 'ZSTD_skippableHeaderSize' defined but not used [-Wunused-const-variable=]
     798 | static const size_t ZSTD_skippableHeaderSize = 8;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:796:21: warning: 'ZSTD_frameHeaderSize_max' defined but not used [-Wunused-const-variable=]
     796 | static const size_t ZSTD_frameHeaderSize_max = ZSTD_FRAMEHEADERSIZE_MAX;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:795:21: warning: 'ZSTD_frameHeaderSize_min' defined but not used [-Wunused-const-variable=]
     795 | static const size_t ZSTD_frameHeaderSize_min = ZSTD_FRAMEHEADERSIZE_MIN;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/zstd.h:794:21: warning: 'ZSTD_frameHeaderSize_prefix' defined but not used [-Wunused-const-variable=]
     794 | static const size_t ZSTD_frameHeaderSize_prefix = 5;
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rculist_bl.h:24:33: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:24:33: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
   include/linux/rculist_bl.h:17:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node [noderef] __rcu *
   include/linux/rculist_bl.h:17:9: sparse:    struct hlist_bl_node *
   In file included from fs/btrfs/compression.c:22:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/signalfd.c:66:33: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected struct wait_queue_head [usertype] *wait_address @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:66:33: sparse:     expected struct wait_queue_head [usertype] *wait_address
   fs/signalfd.c:66:33: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:68:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:68:31: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:68:31: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:73:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:73:33: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:73:33: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:108:32: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:125:33: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:131:33: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:150:32: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:154:38: sparse: sparse: cast removes address space '__user' of expression
   fs/signalfd.c:172:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:172:31: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:172:31: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:181:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:181:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:181:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:185:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:185:32: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:185:32: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:195:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:195:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:195:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:197:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:197:39: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:197:39: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:199:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:199:33: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:199:33: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:201:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:201:35: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:201:35: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/signalfd.c:301:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:301:39: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:301:39: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:303:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __rcu * @@
   fs/signalfd.c:303:41: sparse:     expected struct spinlock [usertype] *lock
   fs/signalfd.c:303:41: sparse:     got struct spinlock [noderef] __rcu *
   fs/signalfd.c:305:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct wait_queue_head *wq_head @@     got struct wait_queue_head [noderef] __rcu * @@
   fs/signalfd.c:305:17: sparse:     expected struct wait_queue_head *wq_head
   fs/signalfd.c:305:17: sparse:     got struct wait_queue_head [noderef] __rcu *
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'tree' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'offset' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'next_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'prev_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'p_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:414: warning: Function parameter or member 'parent_ret' not described in '__etree_search'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'tree' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'start' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'start_ret' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'end_ret' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1616: warning: Function parameter or member 'bits' not described in 'find_contiguous_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'tree' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'start' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'start_ret' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'end_ret' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:1653: warning: Function parameter or member 'bits' not described in 'find_first_clear_extent_bit'
   fs/btrfs/extent_io.c:4152: warning: Function parameter or member 'epd' not described in 'extent_write_cache_pages'
   fs/btrfs/extent_io.c:4152: warning: Excess function parameter 'data' description in 'extent_write_cache_pages'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'root' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'inode' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'ctl' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'block_group' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'io_ctl' not described in '__btrfs_write_out_cache'
   fs/btrfs/free-space-cache.c:1260: warning: Function parameter or member 'trans' not described in '__btrfs_write_out_cache'
   fs/cifs/smb2misc.c:630:47: sparse: sparse: undefined identifier 'lw'
>> fs/cifs/smb2misc.c:542:24: sparse: sparse: context imbalance in 'smb2_tcon_has_lease' - unexpected unlock
>> fs/cifs/smb2misc.c:594:1: sparse: sparse: context imbalance in 'smb2_is_valid_lease_break' - wrong count at exit
   fs/cifs/smb2misc.c: In function 'smb2_is_valid_lease_break':
   fs/cifs/smb2misc.c:630:12: error: 'lw' undeclared (first use in this function)
     630 |      kfree(lw);
         |            ^~
   fs/cifs/smb2misc.c:630:12: note: each undeclared identifier is reported only once for each function it appears in
   make[3]: *** [scripts/Makefile.build:281: fs/cifs/smb2misc.o] Error 1
   fs/gfs2/inode.c:297: warning: Function parameter or member 'dir' not described in 'gfs2_lookupi'
   fs/gfs2/inode.c:297: warning: Excess function parameter 'd_gh' description in 'gfs2_lookupi'
   fs/gfs2/inode.c:297: warning: Excess function parameter 'i_gh' description in 'gfs2_lookupi'
   fs/gfs2/inode.c:478: warning: Excess function parameter 'bhp' description in 'init_dinode'
   fs/gfs2/inode.c:599: warning: Function parameter or member 'excl' not described in 'gfs2_create_inode'
   fs/gfs2/inode.c:845: warning: Function parameter or member 'excl' not described in 'gfs2_create'
   fs/gfs2/inode.c:1089: warning: Function parameter or member 'dentry' not described in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1089: warning: Excess function parameter 'name' description in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1089: warning: Excess function parameter 'inode' description in 'gfs2_unlink_inode'
   fs/gfs2/inode.c:1834: warning: Excess function parameter 'flags' description in 'gfs2_permission'
   fs/gfs2/inode.c:1875: warning: Function parameter or member 'inode' not described in 'gfs2_setattr_simple'
   In file included from fs/btrfs/delayed-ref.c:9:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/gfs2/recovery.c:165: warning: Function parameter or member 'head' not described in 'get_log_header'
   fs/gfs2/recovery.c:165: warning: Excess function parameter 'lh' description in 'get_log_header'
   fs/gfs2/recovery.c:195: warning: Function parameter or member 'pass' not described in 'foreach_descriptor'
   fs/btrfs/delayed-ref.c:80: warning: Function parameter or member 'fs_info' not described in 'btrfs_delayed_refs_rsv_release'
   fs/btrfs/delayed-ref.c:80: warning: Function parameter or member 'nr' not described in 'btrfs_delayed_refs_rsv_release'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'fs_info' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'src' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:128: warning: Function parameter or member 'num_bytes' not described in 'btrfs_migrate_to_delayed_refs_rsv'
   fs/btrfs/delayed-ref.c:174: warning: Function parameter or member 'fs_info' not described in 'btrfs_delayed_refs_rsv_refill'
   fs/btrfs/delayed-ref.c:174: warning: Function parameter or member 'flush' not described in 'btrfs_delayed_refs_rsv_refill'
   fs/eventpoll.c:1131: warning: Function parameter or member 'new' not described in 'list_add_tail_lockless'
   fs/eventpoll.c:1131: warning: Function parameter or member 'head' not described in 'list_add_tail_lockless'
   fs/eventpoll.c:1171: warning: Function parameter or member 'epi' not described in 'chain_epi_lockless'
   fs/btrfs/inode.c:2953: warning: Function parameter or member 'fs_info' not described in 'btrfs_wait_on_delayed_iputs'
   In file included from fs/btrfs/relocation.c:13:
   fs/btrfs/ctree.h:2217:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2217 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/xfs/xfs_extent_busy.c:572:33: sparse: sparse: context imbalance in 'xfs_extent_busy_clear' - unexpected unlock
   fs/io_uring.c:2350:24: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected void [noderef] __user * @@     got struct io_buffer *[assigned] kbuf @@
   fs/io_uring.c:2350:24: sparse:     expected void [noderef] __user *
   fs/io_uring.c:2350:24: sparse:     got struct io_buffer *[assigned] kbuf
   fs/io_uring.c:2518:40: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected void [noderef] __user *[assigned] iov_base @@     got void * @@
   fs/io_uring.c:2518:40: sparse:     expected void [noderef] __user *[assigned] iov_base
   fs/io_uring.c:2518:40: sparse:     got void *
   fs/io_uring.c:2901:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected long long [noderef] [usertype] __user *off_in @@     got long long [usertype] *[assigned] poff_in @@
   fs/io_uring.c:2901:37: sparse:     expected long long [noderef] [usertype] __user *off_in
   fs/io_uring.c:2901:37: sparse:     got long long [usertype] *[assigned] poff_in
   fs/io_uring.c:2901:51: sparse: sparse: incorrect type in argument 4 (different address spaces) @@     expected long long [noderef] [usertype] __user *off_out @@     got long long [usertype] *[assigned] poff_out @@
   fs/io_uring.c:2901:51: sparse:     expected long long [noderef] [usertype] __user *off_out
   fs/io_uring.c:2901:51: sparse:     got long long [usertype] *[assigned] poff_out
   fs/io_uring.c:4085:72: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [usertype] mask @@
   fs/io_uring.c:4085:72: sparse:     expected int mask
   fs/io_uring.c:4085:72: sparse:     got restricted __poll_t [usertype] mask
   fs/io_uring.c:4090:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] result @@     got restricted __poll_t [usertype] mask @@
   fs/io_uring.c:4090:21: sparse:     expected unsigned int [usertype] result
   fs/io_uring.c:4090:21: sparse:     got restricted __poll_t [usertype] mask
   fs/io_uring.c:4116:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] result @@     got restricted __poll_t @@
   fs/io_uring.c:4116:29: sparse:     expected unsigned int [usertype] result
   fs/io_uring.c:4116:29: sparse:     got restricted __poll_t
   fs/io_uring.c:4166:34: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __poll_t [usertype] mask @@     got unsigned int [usertype] result @@
   fs/io_uring.c:4166:34: sparse:     expected restricted __poll_t [usertype] mask
   fs/io_uring.c:4166:34: sparse:     got unsigned int [usertype] result
   fs/io_uring.c:4344:41: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [usertype] @@
   fs/io_uring.c:4344:41: sparse:     expected int mask
   fs/io_uring.c:4344:41: sparse:     got restricted __poll_t [usertype]
   fs/io_uring.c:4429:22: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4429:22: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4429:22: sparse:    right side has type int
   fs/io_uring.c:4431:22: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4431:22: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4431:22: sparse:    right side has type int
   fs/io_uring.c:4432:14: sparse: sparse: invalid assignment: |=
   fs/io_uring.c:4432:14: sparse:    left side has type restricted __poll_t
   fs/io_uring.c:4432:14: sparse:    right side has type int
   fs/io_uring.c:4450:67: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected int mask @@     got restricted __poll_t [assigned] [usertype] mask @@
   fs/io_uring.c:4450:67: sparse:     expected int mask
   fs/io_uring.c:4450:67: sparse:     got restricted __poll_t [assigned] [usertype] mask
   fs/io_uring.c:4451:52: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected int events @@     got restricted __poll_t [usertype] events @@
   fs/io_uring.c:4451:52: sparse:     expected int events
   fs/io_uring.c:4451:52: sparse:     got restricted __poll_t [usertype] events
   fs/btrfs/scrub.c:1180:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:1180:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:1189:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:1189:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:703:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:703:17: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:717:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:717:9: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:775:25: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:775:25: sparse:    struct rcu_string *
   fs/btrfs/scrub.c:2136:17: sparse: sparse: incompatible types in comparison expression (different address spaces):
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string [noderef] __rcu *
   fs/btrfs/scrub.c:2136:17: sparse:    struct rcu_string *
--
   fs/cifs/cifsglob.h:1903:41: sparse: sparse: symbol 'cifs_tcp_ses_list' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1915:41: sparse: sparse: symbol 'cifs_tcp_ses_lock' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1927:28: sparse: sparse: symbol 'GlobalCurrentXid' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1928:28: sparse: sparse: symbol 'GlobalTotalActiveXid' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1929:28: sparse: sparse: symbol 'GlobalMaxActiveXid' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1930:26: sparse: sparse: symbol 'GlobalMid_Lock' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1935:24: sparse: sparse: symbol 'sesInfoAllocCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1936:24: sparse: sparse: symbol 'tconInfoAllocCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1937:24: sparse: sparse: symbol 'tcpSesAllocCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1938:24: sparse: sparse: symbol 'tcpSesReconnectCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1939:24: sparse: sparse: symbol 'tconInfoReconnectCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1942:24: sparse: sparse: symbol 'bufAllocCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1948:24: sparse: sparse: symbol 'smBufAllocCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1949:24: sparse: sparse: symbol 'midCount' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1964:30: sparse: sparse: symbol 'uidtree' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1965:30: sparse: sparse: symbol 'gidtree' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1966:26: sparse: sparse: symbol 'siduidlock' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1967:26: sparse: sparse: symbol 'sidgidlock' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1968:30: sparse: sparse: symbol 'siduidtree' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1969:30: sparse: sparse: symbol 'sidgidtree' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1970:26: sparse: sparse: symbol 'uidsidlock' was not declared. Should it be static?
   fs/cifs/cifsglob.h:1971:26: sparse: sparse: symbol 'gidsidlock' was not declared. Should it be static?
   fs/cifs/connect.c:2925: warning: Function parameter or member 'ses' not described in 'cifs_setup_ipc'
   fs/cifs/connect.c:2925: warning: Function parameter or member 'volume_info' not described in 'cifs_setup_ipc'
   fs/cifs/connect.c:2984: warning: Function parameter or member 'ses' not described in 'cifs_free_ipc'
   fs/cifs/connect.c:3233: warning: Function parameter or member 'server' not described in 'cifs_get_smb_ses'
   fs/cifs/connect.c:3233: warning: Function parameter or member 'volume_info' not described in 'cifs_get_smb_ses'
   fs/cifs/connect.c:3446: warning: Function parameter or member 'ses' not described in 'cifs_get_tcon'
   fs/cifs/connect.c:3446: warning: Function parameter or member 'volume_info' not described in 'cifs_get_tcon'
   fs/cifs/connect.c:4426: warning: Function parameter or member 'xid' not described in 'expand_dfs_referral'
   fs/cifs/connect.c:4426: warning: Function parameter or member 'ses' not described in 'expand_dfs_referral'
   fs/cifs/connect.c:4426: warning: Function parameter or member 'volume_info' not described in 'expand_dfs_referral'
   fs/cifs/connect.c:4426: warning: Function parameter or member 'cifs_sb' not described in 'expand_dfs_referral'
   fs/cifs/connect.c:4426: warning: Function parameter or member 'check_prefix' not described in 'expand_dfs_referral'
   fs/cifs/inode.c: In function 'smb311_posix_get_inode_info':
   fs/cifs/inode.c:1089:26: warning: variable 'server' set but not used [-Wunused-but-set-variable]
    1089 |  struct TCP_Server_Info *server;
         |                          ^~~~~~
   fs/cifs/file.c:421: warning: Function parameter or member 'cifs_file' not described in 'cifsFileInfo_put'
   fs/cifs/file.c:440: warning: Function parameter or member 'cifs_file' not described in '_cifsFileInfo_put'
   fs/cifs/file.c:440: warning: Function parameter or member 'wait_oplock_handler' not described in '_cifsFileInfo_put'
   fs/cifs/file.c:440: warning: Function parameter or member 'offload' not described in '_cifsFileInfo_put'
   fs/cifs/inode.c:804: warning: Function parameter or member 'xid' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:804: warning: Function parameter or member 'tcon' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:804: warning: Function parameter or member 'sb' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:804: warning: Function parameter or member 'full_path' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:804: warning: Function parameter or member 'resp_buf' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:804: warning: Function parameter or member 'data' not described in 'cifs_backup_query_path_info'
   fs/cifs/inode.c:2211: warning: Function parameter or member 'key' not described in 'cifs_wait_bit_killable'
   fs/cifs/inode.c:2211: warning: Function parameter or member 'mode' not described in 'cifs_wait_bit_killable'
   fs/cifs/inode.c:2211: warning: Excess function parameter 'word' description in 'cifs_wait_bit_killable'
   fs/cifs/misc.c:613: warning: Function parameter or member 'cfile' not described in 'cifs_queue_oplock_break'
   fs/cifs/misc.c:928: warning: Function parameter or member 'name' not described in 'cifs_alloc_hash'
   fs/cifs/misc.c:928: warning: Function parameter or member 'shash' not described in 'cifs_alloc_hash'
   fs/cifs/misc.c:928: warning: Function parameter or member 'sdesc' not described in 'cifs_alloc_hash'
   fs/cifs/misc.c:964: warning: Function parameter or member 'shash' not described in 'cifs_free_hash'
   fs/cifs/misc.c:964: warning: Function parameter or member 'sdesc' not described in 'cifs_free_hash'
   fs/cifs/misc.c:979: warning: Function parameter or member 'rqst' not described in 'rqst_page_get_length'
   fs/cifs/misc.c:979: warning: Function parameter or member 'page' not described in 'rqst_page_get_length'
   fs/cifs/misc.c:979: warning: Function parameter or member 'len' not described in 'rqst_page_get_length'
   fs/cifs/misc.c:979: warning: Function parameter or member 'offset' not described in 'rqst_page_get_length'
   fs/cifs/misc.c:1012: warning: Function parameter or member 'dst' not described in 'copy_path_name'
   fs/cifs/misc.c:1012: warning: Function parameter or member 'src' not described in 'copy_path_name'
   fs/cifs/ioctl.c: In function 'cifs_ioctl':
   fs/cifs/ioctl.c:174:10: warning: variable 'caps' set but not used [-Wunused-but-set-variable]
     174 |  __u64   caps;
         |          ^~~~
   fs/cifs/smb2misc.c:630:47: sparse: sparse: undefined identifier 'lw'
>> fs/cifs/smb2misc.c:542:24: sparse: sparse: context imbalance in 'smb2_tcon_has_lease' - unexpected unlock
>> fs/cifs/smb2misc.c:594:1: sparse: sparse: context imbalance in 'smb2_is_valid_lease_break' - wrong count at exit
   fs/cifs/smb2misc.c: In function 'smb2_is_valid_lease_break':
   fs/cifs/smb2misc.c:630:12: error: 'lw' undeclared (first use in this function)
     630 |      kfree(lw);
         |            ^~
   fs/cifs/smb2misc.c:630:12: note: each undeclared identifier is reported only once for each function it appears in
   make[3]: *** [scripts/Makefile.build:281: fs/cifs/smb2misc.o] Error 1
   make[3]: Target '__build' not remade because of errors.
--
   fs/cifs/smb2misc.c:630:47: sparse: sparse: undefined identifier 'lw'
>> fs/cifs/smb2misc.c:542:24: sparse: sparse: context imbalance in 'smb2_tcon_has_lease' - unexpected unlock
>> fs/cifs/smb2misc.c:594:1: sparse: sparse: context imbalance in 'smb2_is_valid_lease_break' - wrong count at exit

# https://github.com/0day-ci/linux/commit/7a32ab08f9e865fa52cfb802786e6fd39df45ea3
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 7a32ab08f9e865fa52cfb802786e6fd39df45ea3
vim +/smb2_tcon_has_lease +542 fs/cifs/smb2misc.c

233839b1df65a2 Pavel Shilovsky 2012-09-19  506  
0822f51426b51b Pavel Shilovsky 2012-09-19  507  static bool
7a32ab08f9e865 Paul Aurich     2020-06-29  508  smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp)
0822f51426b51b Pavel Shilovsky 2012-09-19  509  {
933d4b36576c95 Pavel Shilovsky 2013-09-05  510  	bool found;
933d4b36576c95 Pavel Shilovsky 2013-09-05  511  	__u8 lease_state;
933d4b36576c95 Pavel Shilovsky 2013-09-05  512  	struct list_head *tmp;
0822f51426b51b Pavel Shilovsky 2012-09-19  513  	struct cifsFileInfo *cfile;
233839b1df65a2 Pavel Shilovsky 2012-09-19  514  	struct cifs_pending_open *open;
933d4b36576c95 Pavel Shilovsky 2013-09-05  515  	struct cifsInodeInfo *cinode;
12e8a20824677f Steve French    2012-09-19  516  	int ack_req = le32_to_cpu(rsp->Flags &
12e8a20824677f Steve French    2012-09-19  517  				  SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED);
7a32ab08f9e865 Paul Aurich     2020-06-29  518  	struct smb2_lease_break_work *lw;
7a32ab08f9e865 Paul Aurich     2020-06-29  519  	struct tcon_link *tlink;
7a32ab08f9e865 Paul Aurich     2020-06-29  520  	__u8 lease_key[SMB2_LEASE_KEY_SIZE];
233839b1df65a2 Pavel Shilovsky 2012-09-19  521  
53ef1016fd0e4b Pavel Shilovsky 2013-09-05  522  	lease_state = le32_to_cpu(rsp->NewLeaseState);
0822f51426b51b Pavel Shilovsky 2012-09-19  523  
7a32ab08f9e865 Paul Aurich     2020-06-29  524  	spin_lock(&tcon->open_file_lock);
933d4b36576c95 Pavel Shilovsky 2013-09-05  525  	list_for_each(tmp, &tcon->openFileList) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  526  		cfile = list_entry(tmp, struct cifsFileInfo, tlist);
2b0143b5c986be David Howells   2015-03-17  527  		cinode = CIFS_I(d_inode(cfile->dentry));
0822f51426b51b Pavel Shilovsky 2012-09-19  528  
0822f51426b51b Pavel Shilovsky 2012-09-19  529  		if (memcmp(cinode->lease_key, rsp->LeaseKey,
0822f51426b51b Pavel Shilovsky 2012-09-19  530  							SMB2_LEASE_KEY_SIZE))
0822f51426b51b Pavel Shilovsky 2012-09-19  531  			continue;
0822f51426b51b Pavel Shilovsky 2012-09-19  532  
f96637be081141 Joe Perches     2013-05-04  533  		cifs_dbg(FYI, "found in the open list\n");
59b04c5df75bd7 Steve French    2014-08-02  534  		cifs_dbg(FYI, "lease key match, lease break 0x%x\n",
9bd45408366840 Pavel Shilovsky 2019-10-29  535  			 lease_state);
0822f51426b51b Pavel Shilovsky 2012-09-19  536  
233839b1df65a2 Pavel Shilovsky 2012-09-19  537  		if (ack_req)
0822f51426b51b Pavel Shilovsky 2012-09-19  538  			cfile->oplock_break_cancelled = false;
0822f51426b51b Pavel Shilovsky 2012-09-19  539  		else
0822f51426b51b Pavel Shilovsky 2012-09-19  540  			cfile->oplock_break_cancelled = true;
0822f51426b51b Pavel Shilovsky 2012-09-19  541  
7b9b9edb49ad37 Pavel Shilovsky 2019-02-13 @542  		set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags);
7b9b9edb49ad37 Pavel Shilovsky 2019-02-13  543  
9bd45408366840 Pavel Shilovsky 2019-10-29  544  		cfile->oplock_epoch = le16_to_cpu(rsp->Epoch);
9bd45408366840 Pavel Shilovsky 2019-10-29  545  		cfile->oplock_level = lease_state;
7b9b9edb49ad37 Pavel Shilovsky 2019-02-13  546  
b98749cac4a695 Aurelien Aptel  2019-03-29  547  		cifs_queue_oplock_break(cfile);
7a32ab08f9e865 Paul Aurich     2020-06-29  548  		spin_unlock(&tcon->open_file_lock);
7a32ab08f9e865 Paul Aurich     2020-06-29  549  		spin_unlock(&cifs_tcp_ses_lock);
0822f51426b51b Pavel Shilovsky 2012-09-19  550  		return true;
0822f51426b51b Pavel Shilovsky 2012-09-19  551  	}
233839b1df65a2 Pavel Shilovsky 2012-09-19  552  
233839b1df65a2 Pavel Shilovsky 2012-09-19  553  	found = false;
233839b1df65a2 Pavel Shilovsky 2012-09-19  554  	list_for_each_entry(open, &tcon->pending_opens, olist) {
233839b1df65a2 Pavel Shilovsky 2012-09-19  555  		if (memcmp(open->lease_key, rsp->LeaseKey,
233839b1df65a2 Pavel Shilovsky 2012-09-19  556  			   SMB2_LEASE_KEY_SIZE))
233839b1df65a2 Pavel Shilovsky 2012-09-19  557  			continue;
233839b1df65a2 Pavel Shilovsky 2012-09-19  558  
233839b1df65a2 Pavel Shilovsky 2012-09-19  559  		if (!found && ack_req) {
233839b1df65a2 Pavel Shilovsky 2012-09-19  560  			found = true;
7a32ab08f9e865 Paul Aurich     2020-06-29  561  			memcpy(lease_key, open->lease_key,
233839b1df65a2 Pavel Shilovsky 2012-09-19  562  			       SMB2_LEASE_KEY_SIZE);
7a32ab08f9e865 Paul Aurich     2020-06-29  563  			tlink = cifs_get_tlink(open->tlink);
233839b1df65a2 Pavel Shilovsky 2012-09-19  564  		}
233839b1df65a2 Pavel Shilovsky 2012-09-19  565  
f96637be081141 Joe Perches     2013-05-04  566  		cifs_dbg(FYI, "found in the pending open list\n");
59b04c5df75bd7 Steve French    2014-08-02  567  		cifs_dbg(FYI, "lease key match, lease break 0x%x\n",
9bd45408366840 Pavel Shilovsky 2019-10-29  568  			 lease_state);
233839b1df65a2 Pavel Shilovsky 2012-09-19  569  
933d4b36576c95 Pavel Shilovsky 2013-09-05  570  		open->oplock = lease_state;
933d4b36576c95 Pavel Shilovsky 2013-09-05  571  	}
a93864d93977b9 Ronnie Sahlberg 2018-06-14  572  
7a32ab08f9e865 Paul Aurich     2020-06-29  573  	spin_unlock(&tcon->open_file_lock);
7a32ab08f9e865 Paul Aurich     2020-06-29  574  	if (found) {
7a32ab08f9e865 Paul Aurich     2020-06-29  575  		spin_unlock(&cifs_tcp_ses_lock);
7a32ab08f9e865 Paul Aurich     2020-06-29  576  
7a32ab08f9e865 Paul Aurich     2020-06-29  577  		lw = kmalloc(sizeof(struct smb2_lease_break_work), GFP_KERNEL);
7a32ab08f9e865 Paul Aurich     2020-06-29  578  		if (!lw) {
7a32ab08f9e865 Paul Aurich     2020-06-29  579  			cifs_put_tlink(tlink);
7a32ab08f9e865 Paul Aurich     2020-06-29  580  			return true;
7a32ab08f9e865 Paul Aurich     2020-06-29  581  		}
7a32ab08f9e865 Paul Aurich     2020-06-29  582  
7a32ab08f9e865 Paul Aurich     2020-06-29  583  		INIT_WORK(&lw->lease_break, cifs_ses_oplock_break);
7a32ab08f9e865 Paul Aurich     2020-06-29  584  		lw->tlink = tlink;
7a32ab08f9e865 Paul Aurich     2020-06-29  585  		lw->lease_state = rsp->NewLeaseState;
7a32ab08f9e865 Paul Aurich     2020-06-29  586  		memcpy(lw->lease_key, lease_key, SMB2_LEASE_KEY_SIZE);
7a32ab08f9e865 Paul Aurich     2020-06-29  587  		queue_work(cifsiod_wq, &lw->lease_break);
7a32ab08f9e865 Paul Aurich     2020-06-29  588  	}
7a32ab08f9e865 Paul Aurich     2020-06-29  589  
933d4b36576c95 Pavel Shilovsky 2013-09-05  590  	return found;
233839b1df65a2 Pavel Shilovsky 2012-09-19  591  }
933d4b36576c95 Pavel Shilovsky 2013-09-05  592  
933d4b36576c95 Pavel Shilovsky 2013-09-05  593  static bool
933d4b36576c95 Pavel Shilovsky 2013-09-05 @594  smb2_is_valid_lease_break(char *buffer)
933d4b36576c95 Pavel Shilovsky 2013-09-05  595  {
933d4b36576c95 Pavel Shilovsky 2013-09-05  596  	struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer;
933d4b36576c95 Pavel Shilovsky 2013-09-05  597  	struct list_head *tmp, *tmp1, *tmp2;
933d4b36576c95 Pavel Shilovsky 2013-09-05  598  	struct TCP_Server_Info *server;
933d4b36576c95 Pavel Shilovsky 2013-09-05  599  	struct cifs_ses *ses;
933d4b36576c95 Pavel Shilovsky 2013-09-05  600  	struct cifs_tcon *tcon;
933d4b36576c95 Pavel Shilovsky 2013-09-05  601  
933d4b36576c95 Pavel Shilovsky 2013-09-05  602  	cifs_dbg(FYI, "Checking for lease break\n");
933d4b36576c95 Pavel Shilovsky 2013-09-05  603  
933d4b36576c95 Pavel Shilovsky 2013-09-05  604  	/* look up tcon based on tid & uid */
933d4b36576c95 Pavel Shilovsky 2013-09-05  605  	spin_lock(&cifs_tcp_ses_lock);
933d4b36576c95 Pavel Shilovsky 2013-09-05  606  	list_for_each(tmp, &cifs_tcp_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  607  		server = list_entry(tmp, struct TCP_Server_Info, tcp_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  608  
933d4b36576c95 Pavel Shilovsky 2013-09-05  609  		list_for_each(tmp1, &server->smb_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  610  			ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  611  
933d4b36576c95 Pavel Shilovsky 2013-09-05  612  			list_for_each(tmp2, &ses->tcon_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  613  				tcon = list_entry(tmp2, struct cifs_tcon,
933d4b36576c95 Pavel Shilovsky 2013-09-05  614  						  tcon_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  615  				cifs_stats_inc(
933d4b36576c95 Pavel Shilovsky 2013-09-05  616  				    &tcon->stats.cifs_stats.num_oplock_brks);
7a32ab08f9e865 Paul Aurich     2020-06-29  617  				if (smb2_tcon_has_lease(tcon, rsp)) {
233839b1df65a2 Pavel Shilovsky 2012-09-19  618  					return true;
233839b1df65a2 Pavel Shilovsky 2012-09-19  619  				}
a93864d93977b9 Ronnie Sahlberg 2018-06-14  620  
a93864d93977b9 Ronnie Sahlberg 2018-06-14  621  				if (tcon->crfid.is_valid &&
a93864d93977b9 Ronnie Sahlberg 2018-06-14  622  				    !memcmp(rsp->LeaseKey,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  623  					    tcon->crfid.fid->lease_key,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  624  					    SMB2_LEASE_KEY_SIZE)) {
a93864d93977b9 Ronnie Sahlberg 2018-06-14  625  					INIT_WORK(&tcon->crfid.lease_break,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  626  						  smb2_cached_lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  627  					queue_work(cifsiod_wq,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  628  						   &tcon->crfid.lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  629  					spin_unlock(&cifs_tcp_ses_lock);
d6ac9c584a6902 Paul Aurich     2020-06-26 @630  					kfree(lw);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  631  					return true;
a93864d93977b9 Ronnie Sahlberg 2018-06-14  632  				}
0822f51426b51b Pavel Shilovsky 2012-09-19  633  			}
0822f51426b51b Pavel Shilovsky 2012-09-19  634  		}
933d4b36576c95 Pavel Shilovsky 2013-09-05  635  	}
0822f51426b51b Pavel Shilovsky 2012-09-19  636  	spin_unlock(&cifs_tcp_ses_lock);
f96637be081141 Joe Perches     2013-05-04  637  	cifs_dbg(FYI, "Can not process lease break - no lease matched\n");
0822f51426b51b Pavel Shilovsky 2012-09-19  638  	return false;
0822f51426b51b Pavel Shilovsky 2012-09-19  639  }
0822f51426b51b Pavel Shilovsky 2012-09-19  640  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32078 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH v2] cifs: Fix leak when handling lease break for cached root fid
@ 2020-06-30 10:04 kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-06-30 10:04 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5274 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200630023003.1858066-1-paul@darkrain42.org>
References: <20200630023003.1858066-1-paul@darkrain42.org>
TO: Paul Aurich <paul@darkrain42.org>

Hi Paul,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on v5.8-rc3 next-20200629]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Paul-Aurich/cifs-Fix-leak-when-handling-lease-break-for-cached-root-fid/20200630-103420
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
:::::: branch date: 8 hours ago
:::::: commit date: 8 hours ago
config: i386-randconfig-c003-20200630 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> fs/cifs/smb2misc.c:618:5-11: preceding lock on line 605

# https://github.com/0day-ci/linux/commit/7a32ab08f9e865fa52cfb802786e6fd39df45ea3
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 7a32ab08f9e865fa52cfb802786e6fd39df45ea3
vim +618 fs/cifs/smb2misc.c

933d4b36576c95 Pavel Shilovsky 2013-09-05  592  
933d4b36576c95 Pavel Shilovsky 2013-09-05  593  static bool
933d4b36576c95 Pavel Shilovsky 2013-09-05  594  smb2_is_valid_lease_break(char *buffer)
933d4b36576c95 Pavel Shilovsky 2013-09-05  595  {
933d4b36576c95 Pavel Shilovsky 2013-09-05  596  	struct smb2_lease_break *rsp = (struct smb2_lease_break *)buffer;
933d4b36576c95 Pavel Shilovsky 2013-09-05  597  	struct list_head *tmp, *tmp1, *tmp2;
933d4b36576c95 Pavel Shilovsky 2013-09-05  598  	struct TCP_Server_Info *server;
933d4b36576c95 Pavel Shilovsky 2013-09-05  599  	struct cifs_ses *ses;
933d4b36576c95 Pavel Shilovsky 2013-09-05  600  	struct cifs_tcon *tcon;
933d4b36576c95 Pavel Shilovsky 2013-09-05  601  
933d4b36576c95 Pavel Shilovsky 2013-09-05  602  	cifs_dbg(FYI, "Checking for lease break\n");
933d4b36576c95 Pavel Shilovsky 2013-09-05  603  
933d4b36576c95 Pavel Shilovsky 2013-09-05  604  	/* look up tcon based on tid & uid */
933d4b36576c95 Pavel Shilovsky 2013-09-05 @605  	spin_lock(&cifs_tcp_ses_lock);
933d4b36576c95 Pavel Shilovsky 2013-09-05  606  	list_for_each(tmp, &cifs_tcp_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  607  		server = list_entry(tmp, struct TCP_Server_Info, tcp_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  608  
933d4b36576c95 Pavel Shilovsky 2013-09-05  609  		list_for_each(tmp1, &server->smb_ses_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  610  			ses = list_entry(tmp1, struct cifs_ses, smb_ses_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  611  
933d4b36576c95 Pavel Shilovsky 2013-09-05  612  			list_for_each(tmp2, &ses->tcon_list) {
933d4b36576c95 Pavel Shilovsky 2013-09-05  613  				tcon = list_entry(tmp2, struct cifs_tcon,
933d4b36576c95 Pavel Shilovsky 2013-09-05  614  						  tcon_list);
933d4b36576c95 Pavel Shilovsky 2013-09-05  615  				cifs_stats_inc(
933d4b36576c95 Pavel Shilovsky 2013-09-05  616  				    &tcon->stats.cifs_stats.num_oplock_brks);
7a32ab08f9e865 Paul Aurich     2020-06-29  617  				if (smb2_tcon_has_lease(tcon, rsp)) {
233839b1df65a2 Pavel Shilovsky 2012-09-19 @618  					return true;
233839b1df65a2 Pavel Shilovsky 2012-09-19  619  				}
a93864d93977b9 Ronnie Sahlberg 2018-06-14  620  
a93864d93977b9 Ronnie Sahlberg 2018-06-14  621  				if (tcon->crfid.is_valid &&
a93864d93977b9 Ronnie Sahlberg 2018-06-14  622  				    !memcmp(rsp->LeaseKey,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  623  					    tcon->crfid.fid->lease_key,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  624  					    SMB2_LEASE_KEY_SIZE)) {
a93864d93977b9 Ronnie Sahlberg 2018-06-14  625  					INIT_WORK(&tcon->crfid.lease_break,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  626  						  smb2_cached_lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  627  					queue_work(cifsiod_wq,
a93864d93977b9 Ronnie Sahlberg 2018-06-14  628  						   &tcon->crfid.lease_break);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  629  					spin_unlock(&cifs_tcp_ses_lock);
d6ac9c584a6902 Paul Aurich     2020-06-26  630  					kfree(lw);
a93864d93977b9 Ronnie Sahlberg 2018-06-14  631  					return true;
a93864d93977b9 Ronnie Sahlberg 2018-06-14  632  				}
0822f51426b51b Pavel Shilovsky 2012-09-19  633  			}
0822f51426b51b Pavel Shilovsky 2012-09-19  634  		}
933d4b36576c95 Pavel Shilovsky 2013-09-05  635  	}
0822f51426b51b Pavel Shilovsky 2012-09-19  636  	spin_unlock(&cifs_tcp_ses_lock);
f96637be081141 Joe Perches     2013-05-04  637  	cifs_dbg(FYI, "Can not process lease break - no lease matched\n");
0822f51426b51b Pavel Shilovsky 2012-09-19  638  	return false;
0822f51426b51b Pavel Shilovsky 2012-09-19  639  }
0822f51426b51b Pavel Shilovsky 2012-09-19  640  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34026 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-02  0:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-30  2:30 [PATCH v2] cifs: Fix leak when handling lease break for cached root fid Paul Aurich
2020-07-01 13:13 ` Aurélien Aptel
2020-07-02  0:53 ` Steve French
  -- strict thread matches above, loose matches on Subject: below --
2020-06-30  7:34 kernel test robot
2020-06-30 10:04 kernel test robot

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.