Skip to content

Commit cc7d79d

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: fix interface count calculation during refresh
The last fix to iface_count did fix the overcounting issue. However, during each refresh, we could end up undercounting the iface_count, if a match was found. Fixing this by doing increments and decrements instead of setting it to 0 before each parsing of server interfaces. Fixes: 096bbee ("smb3: interface count displayed incorrectly") Cc: [email protected] # 6.1 Signed-off-by: Shyam Prasad N <[email protected]> Reviewed-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7246210 commit cc7d79d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/cifs/smb2ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,6 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
530530
p = buf;
531531

532532
spin_lock(&ses->iface_lock);
533-
ses->iface_count = 0;
534533
/*
535534
* Go through iface_list and do kref_put to remove
536535
* any unused ifaces. ifaces in use will be removed
@@ -540,6 +539,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
540539
iface_head) {
541540
iface->is_active = 0;
542541
kref_put(&iface->refcount, release_iface);
542+
ses->iface_count--;
543543
}
544544
spin_unlock(&ses->iface_lock);
545545

@@ -618,6 +618,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
618618
/* just get a ref so that it doesn't get picked/freed */
619619
iface->is_active = 1;
620620
kref_get(&iface->refcount);
621+
ses->iface_count++;
621622
spin_unlock(&ses->iface_lock);
622623
goto next_iface;
623624
} else if (ret < 0) {

0 commit comments

Comments
 (0)