Skip to content

Commit 2e0fa29

Browse files
sprasad-microsoftsmfrench
authored andcommitted
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 66eb0c6 commit 2e0fa29

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/cifs/sess.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ cifs_ses_add_channel(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses,
347347
/* we rely on all bits beyond chan_count to be clear */
348348
cifs_chan_clear_need_reconnect(ses, chan->server);
349349
ses->chan_count--;
350+
/*
351+
* chan_count should never reach 0 as at least the primary
352+
* channel is always allocated
353+
*/
354+
WARN_ON(ses->chan_count < 1);
350355
spin_unlock(&ses->chan_lock);
351356
}
352357

0 commit comments

Comments
 (0)