Fwd: New Defects reported by Coverity Scan for linux-next weekly scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lightly updated the patch to address the existing missing lock issue
near the same line I changed

See attached

---------- Forwarded message ---------
From: <scan-admin@xxxxxxxxxxxx>
Date: Mon, Oct 17, 2022 at 7:04 AM
Subject: New Defects reported by Coverity Scan for linux-next weekly scan
To: <smfrench@xxxxxxxxx>


Hi,

Please find the latest report on new defect(s) introduced to
linux-next weekly scan, under component 'FS-CIFS',  found with
Coverity Scan.

1 new defect(s) introduced to linux-next weekly scan, under component
'FS-CIFS',  found with Coverity Scan.
7 defect(s), reported by Coverity Scan earlier, were marked fixed in
the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1526374:  Concurrent data access violations  (MISSING_LOCK)
/fs/cifs/smb2ops.c: 657 in parse_server_interfaces()


________________________________________________________________________________________________________
*** CID 1526374:  Concurrent data access violations  (MISSING_LOCK)
/fs/cifs/smb2ops.c: 657 in parse_server_interfaces()
651                             list_add_tail(&info->iface_head,
&iface->iface_head);
652                             kref_put(&iface->refcount, release_iface);
653                     } else
654                             list_add_tail(&info->iface_head,
&ses->iface_list);
655                     spin_unlock(&ses->iface_lock);
656
>>>     CID 1526374:  Concurrent data access violations  (MISSING_LOCK)
>>>     Accessing "ses->iface_count" without holding lock "cifs_ses.iface_lock". Elsewhere, "cifs_ses.iface_count" is accessed with "cifs_ses.iface_lock" held 1 out of 2 times (1 of these accesses strongly imply that it is necessary).
657                     ses->iface_count++;
658                     ses->iface_last_update = jiffies;
659     next_iface:
660                     nb_iface++;
661                     next = le32_to_cpu(p->Next);
662                     if (!next) {


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypWUaxuG23arlAOMqBtlZty8jbpwvvNgxXk-2FmAsxmR9vW5nmNrMx1IpP6MDN1J2o1ZPwtxoZUPo2TKCoVE0eHSfk803_Y7VRim-2Fxl9fmAdBRyG05vGZHoQCljkdhUYA-2FoqqLzdQ99pG1yOfKEIo9MJB7agwTtnlcxoAvqS-2BDtTTUTOWD7T6SBVYeLQSl638-2Fl8BXfhLmGrBb9Xd1yIE5M7TgbMfbvF3Tbswre9yw5CzuyRBh0wEKEyA5bApzoxGHjAPNsTqcnpOwNJh8UEScTPqAQmwuak6ixO1HFu3OSQSs1Vt9Cw-3D-3D

  To manage Coverity Scan email notifications for
"smfrench@xxxxxxxxx", click
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50yped04pjJnmXOsUBtKYNIXxgDITOxfLjGd57Ifg09SfMSZeD9rHMtRaJqZq0ctXqp7fRP-2BE8DxRp97FczN2h9FJkLzTHr7qddqCt-2F0SoddBt8k3Bc5cgjF9mAUP8Y7F8MA-3DWn7Q_Y7VRim-2Fxl9fmAdBRyG05vGZHoQCljkdhUYA-2FoqqLzdQ99pG1yOfKEIo9MJB7agwTRwlJGtThGaSyOc7gNCDGP8d-2Fv8dqdH7vZ2Rcf363XI43urt-2B6W2PUJtvoQox-2BUv-2By441h2k7z7u9E9TtWBaE9dU32vzYmrzG1NktYtHYw1ZDHaIhOxPtqf9t-2B44F9hRmyL3zLHSLj0-2BvSRIk6dpiUw-3D-3D



-- 
Thanks,

Steve
From 3f825b8fa93bb300e60c932753e8c5274b253a77 Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@xxxxxxxxxxxxx>
Date: Sat, 15 Oct 2022 17:02:30 -0500
Subject: [PATCH] smb3: interface count displayed incorrectly

The "Server interfaces" count in /proc/fs/cifs/DebugData increases
as the interfaces are requeried, rather than being reset to the new
value.  This could cause a problem if the server disabled
multichannel as the iface_count is checked in try_adding_channels
to see if multichannel still supported.

Also fixes a coverity warning:

Addresses-Coverity: 1526374 ("Concurrent data access violations  (MISSING_LOCK)")
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx>
---
 fs/cifs/smb2ops.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 17b25153cb68..4f53fa012936 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -530,6 +530,7 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
 	p = buf;
 
 	spin_lock(&ses->iface_lock);
+	ses->iface_count = 0;
 	/*
 	 * Go through iface_list and do kref_put to remove
 	 * any unused ifaces. ifaces in use will be removed
@@ -651,9 +652,9 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf,
 			kref_put(&iface->refcount, release_iface);
 		} else
 			list_add_tail(&info->iface_head, &ses->iface_list);
-		spin_unlock(&ses->iface_lock);
 
 		ses->iface_count++;
+		spin_unlock(&ses->iface_lock);
 		ses->iface_last_update = jiffies;
 next_iface:
 		nb_iface++;
-- 
2.34.1


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux