]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: add WARN_ON for when chan_count goes below minimum
authorShyam Prasad N <sprasad@microsoft.com>
Mon, 19 Jul 2021 14:04:11 +0000 (14:04 +0000)
committerSteve French <stfrench@microsoft.com>
Mon, 3 Jan 2022 02:38:46 +0000 (20:38 -0600)
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>
fs/cifs/sess.c

index b121a2591e696dad00cdfdf07e9f82c6debf30cb..61fc8cb1ec8fe1899611228208ccde0167775d17 100644 (file)
@@ -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);
        }