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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtcoblYi68X8t3Bd@hog>
Date: Tue, 3 Sep 2024 17:17:02 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Antonio Quartulli <antonio@...nvpn.net>
Cc: netdev@...r.kernel.org, kuba@...nel.org, pabeni@...hat.com,
	ryazanov.s.a@...il.com, edumazet@...gle.com, andrew@...n.ch
Subject: Re: [PATCH net-next v6 17/25] ovpn: implement keepalive mechanism

2024-08-27, 14:07:57 +0200, Antonio Quartulli wrote:
> +static time64_t ovpn_peer_keepalive_work_mp(struct ovpn_struct *ovpn,
> +					    time64_t now)
> +{
> +	time64_t tmp_next_run, next_run = 0;
> +	struct hlist_node *tmp;
> +	struct ovpn_peer *peer;
> +	int bkt;
> +
> +	spin_lock_bh(&ovpn->peers->lock_by_id);
> +	hash_for_each_safe(ovpn->peers->by_id, bkt, tmp, peer, hash_entry_id) {
> +		tmp_next_run = ovpn_peer_keepalive_work_single(peer, now);
> +
> +		/* the next worker run will be scheduled based on the shortest
> +		 * required interval across all peers
> +		 */
> +		if (!next_run || tmp_next_run < next_run)

I think this should exclude tmp_next_run == 0.

If we have two peers, with the first getting a non-0 value and the 2nd
getting 0, we'll end up with next_run = 0 on return.

If we have three peers and ovpn_peer_keepalive_work_single returns
12,0,42, we'll end up with 42 (after resetting to 0 on the 2nd peer),
and we could miss sending the needed keepalive for peer 1.

> +			next_run = tmp_next_run;
> +	}
> +	spin_unlock_bh(&ovpn->peers->lock_by_id);
> +
> +	return next_run;
> +}

-- 
Sabrina


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ