Bug 163135 - [netsmb] Wrong check in netsmb
Summary: [netsmb] Wrong check in netsmb
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 1.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Christian Brueffer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 22:00 UTC by Sascha Wildner
Modified: 2012-07-10 22:10 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Wildner 2011-12-08 22:00:20 UTC
Looking at sys/netsmb/smb_trantcp.c I came across the check in line 526
which looks wrong (tv_sec checked twice).

Not 100% sure but I think the intention is to not pass a timeout of 0
so it seems as if it should be

if (ts2.tv_sec == 0 && ts2.tv_usec == 0)

but if changed that way it would lead to different timeouts which is why
I'm kinda unsure (assuming it works OK right now). :)
Comment 1 Christian Brueffer freebsd_committer freebsd_triage 2012-07-03 08:57:52 UTC
Responsible Changed
From-To: freebsd-bugs->brueffer

Grab this.  I talked to bp@ and will commit a fix when I come back next week.
Comment 2 Christian Brueffer freebsd_committer freebsd_triage 2012-07-10 22:03:06 UTC
State Changed
From-To: open->closed

Fix committed, thanks for the report!
Comment 3 dfilter service freebsd_committer freebsd_triage 2012-07-10 22:03:15 UTC
Author: brueffer
Date: Tue Jul 10 21:02:59 2012
New Revision: 238356
URL: http://svn.freebsd.org/changeset/base/238356

Log:
  Change a duplicated check to clarify that we really want to set a
  reasonable default timeout.
  
  PR:		163135
  Submitted by:	Sascha Wildner <saw@online.de>
  Suggested by:	bp
  Reviewed by:	bp

Modified:
  head/sys/netsmb/smb_trantcp.c

Modified: head/sys/netsmb/smb_trantcp.c
==============================================================================
--- head/sys/netsmb/smb_trantcp.c	Tue Jul 10 20:59:35 2012	(r238355)
+++ head/sys/netsmb/smb_trantcp.c	Tue Jul 10 21:02:59 2012	(r238356)
@@ -523,8 +523,10 @@ smb_nbst_connect(struct smb_vc *vcp, str
 		return error;
 	getnanotime(&ts2);
 	timespecsub(&ts2, &ts1);
-	if (ts2.tv_sec == 0 && ts2.tv_sec == 0)
+	if (ts2.tv_sec == 0) {
 		ts2.tv_sec = 1;
+		ts2.tv_nsec = 0;
+	}
 	nbp->nbp_timo = ts2;
 	timespecadd(&nbp->nbp_timo, &ts2);
 	timespecadd(&nbp->nbp_timo, &ts2);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"