Skip to content
Permalink
Browse files
fs:cifs: convert from atomic_t to refcount_t on tlink->tl_count
use refcount_t instead of atomic_t
which prevents reference counter overflows.

Reported-by: Zeal Robot <zealci@zte.com.cm>
Signed-off-by: chiminghao <chi.minghao@zte.com.cn>
  • Loading branch information
chiminghao authored and intel-lab-lkp committed Nov 12, 2021
1 parent 562713f commit 8d0f81fa94784bab585209f6cea84ea63a4a37ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
@@ -8,7 +8,7 @@
*/
#ifndef _CIFS_GLOB_H
#define _CIFS_GLOB_H

#include <linux/refcount.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/inet.h>
@@ -1128,7 +1128,7 @@ struct tcon_link {
#define TCON_LINK_PENDING 1
#define TCON_LINK_IN_TREE 2
unsigned long tl_time;
atomic_t tl_count;
refcount_t tl_count;
struct cifs_tcon *tl_tcon;
};

@@ -2362,7 +2362,7 @@ cifs_put_tlink(struct tcon_link *tlink)
if (!tlink || IS_ERR(tlink))
return;

if (!atomic_dec_and_test(&tlink->tl_count) ||
if (!refcount_dec_and_test(&tlink->tl_count) ||
test_bit(TCON_LINK_IN_TREE, &tlink->tl_flags)) {
tlink->tl_time = jiffies;
return;

0 comments on commit 8d0f81f

Please sign in to comment.