summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
authorShyam Prasad N <sprasad@microsoft.com>2021-07-14 23:00:00 -0500
committerSteve French <stfrench@microsoft.com>2021-07-15 19:07:00 -0500
commit16dd9b8c31aee7ae074fa3ee36a797e9ba9f7e4f (patch)
treed1d3f47648bd38eb5e40c13ccc9013dc32314703 /fs/cifs/smb2ops.c
parent63f94e946fafcfc5080b4a4aec9770158268e4ee (diff)
downloadlinux-16dd9b8c31aee7ae074fa3ee36a797e9ba9f7e4f.tar.gz
linux-16dd9b8c31aee7ae074fa3ee36a797e9ba9f7e4f.tar.bz2
linux-16dd9b8c31aee7ae074fa3ee36a797e9ba9f7e4f.zip
cifs: added WARN_ON for all the count decrements
We have a few ref counters srv_count, ses_count and tc_count which we use for ref counting. Added a WARN_ON during the decrement of each of these counters to make sure that they don't go below their minimum values. Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 232d528df230..ba3c58e1f725 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2910,6 +2910,8 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
/* ipc tcons are not refcounted */
spin_lock(&cifs_tcp_ses_lock);
tcon->tc_count--;
+ /* tc_count can never go negative */
+ WARN_ON(tcon->tc_count < 0);
spin_unlock(&cifs_tcp_ses_lock);
}
kfree(utf16_path);