lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Sat, 8 Dec 2007 13:49:57 +0100
From:	Eric Sesterhenn <snakebyte@....de>
To:	netdev@...r.kernel.org
Subject: [Patch] Incorrect time conversion in TIPC

hi,

the timeouts in tipc/socket.c dont match if HZ is not 1000,
this patch changes it to use the proper conversion functions.

Signed-off-by: Eric Sesterhenn <snakebyte@....de>

--- linux-2.6.24-rc3/net/tipc/socket.c.orig	2007-12-07 20:07:11.000000000 +0100
+++ linux-2.6.24-rc3/net/tipc/socket.c	2007-12-07 20:11:15.000000000 +0100
@@ -209,7 +209,7 @@ static int tipc_create(struct net *net, 
 
 	sock_init_data(sock, sk);
 	init_waitqueue_head(sk->sk_sleep);
-	sk->sk_rcvtimeo = 8 * HZ;   /* default connect timeout = 8s */
+	sk->sk_rcvtimeo = msecs_to_jiffies(8000);   /* default connect timeout = 8s */
 
 	tsock = tipc_sk(sk);
 	port = tipc_get_port(ref);
@@ -1535,7 +1535,7 @@ static int setsockopt(struct socket *soc
 		res = tipc_set_portunreturnable(tsock->p->ref, value);
 		break;
 	case TIPC_CONN_TIMEOUT:
-		sock->sk->sk_rcvtimeo = (value * HZ / 1000);
+		sock->sk->sk_rcvtimeo = msecs_to_jiffies(value);
 		break;
 	default:
 		res = -EINVAL;
@@ -1588,7 +1588,7 @@ static int getsockopt(struct socket *soc
 		res = tipc_portunreturnable(tsock->p->ref, &value);
 		break;
 	case TIPC_CONN_TIMEOUT:
-		value = (sock->sk->sk_rcvtimeo * 1000) / HZ;
+		value = jiffies_to_msecs(sock->sk->sk_rcvtimeo);
 		break;
 	default:
 		res = -EINVAL;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ