diff options
author | Shyam Prasad N <sprasad@microsoft.com> | 2021-07-19 16:04:11 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-01-03 03:38:46 +0100 |
commit | 2e0fa298d149e07005504350358066f380f72b52 (patch) | |
tree | 8b5a78abaeb9339c76ca7653cc9c5a97393cf72f /fs/cifs/sess.c | |
parent | cifs: adjust DebugData to use chans_need_reconnect for conn status (diff) | |
download | linux-2e0fa298d149e07005504350358066f380f72b52.tar.xz linux-2e0fa298d149e07005504350358066f380f72b52.zip |
cifs: add WARN_ON for when chan_count goes below minimum
chan_count keeps track of the total number of channels.
Since at least the primary channel will always be connected,
this value can never go below 1. Warn if that happens.
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r-- | fs/cifs/sess.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index b121a2591e69..61fc8cb1ec8f 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -347,6 +347,11 @@ out: /* we rely on all bits beyond chan_count to be clear */ cifs_chan_clear_need_reconnect(ses, chan->server); ses->chan_count--; + /* + * chan_count should never reach 0 as at least the primary + * channel is always allocated + */ + WARN_ON(ses->chan_count < 1); spin_unlock(&ses->chan_lock); } |