From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59C7A44DB9C for ; Fri, 15 May 2026 09:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.88.38.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778838964; cv=none; b=SY4BLzjmFrihjRVtgYydqJXMugJILKr/xTZDw8cRecST4GTJnJPE4ope5fZ0vEi7KUFBraruR+uGH0qDgM4Rt3ePolJ3eyao64B31ZYnWWTeiVT53IhbdKJa/sg7ftr9KkAdp4q+p8yFq67ZBUuNvN1EqPaQrW4nckikRoAiVsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778838964; c=relaxed/simple; bh=YvA5yUfrwRqEZHewWc950dJrZjcPZ+8ZQr/ZsbmBc/I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tbq3fdfByxOIs+vBEPeQRO7C++oujsMBQuBS0G46ib1y/5BASQiz1KNRQ2twLoZ0Tp2EMvO+omIifcLdW7UpcdEzFOijxRG+ctTswxS4lp9yVF5yWA9R6F63Gd/tsaoNtSSgcryl6TkqYsrdjmLNfNyjEHqzuZjhDT3aExChXrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de; spf=pass smtp.mailfrom=simonwunderlich.de; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b=0ya06e57; arc=none smtp.client-ip=23.88.38.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=simonwunderlich.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=simonwunderlich.de header.i=@simonwunderlich.de header.b="0ya06e57" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=simonwunderlich.de; s=09092022; t=1778838958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pzeglsvftGQq2owmysdqGGIsVR2TLwY6CvuHqBqKR4I=; b=0ya06e57/A7JDgPf04FnAYYR7CDbk/VtV2JfA7EO35HyddZ1cZ2HGzHwyqk+ISWSietKah QlK1xe38dXH+5ulPbVzGkZW2AntNg6YxiAYw6Creye08lPp1O92uyL7rjVnuIo8NJ5xi1J IzxSnC4VJtuGIXwsygPnaf3XRlpn+B5Qo6P47qwsusg2bcP5cGfNGkr+vxQZBI93t2H1Ma +uHpLovM6iUm6TCpPSUIv85DB5QRsONeSyRR3tJmN2ukhOtGaWCL+Fq0VXwwguoeQoRLkN cd47s8mgFTP6TM8QYCxyoc8kqczVJdjiyUFUQX41PdJS2gvsLSaypJGSmPT0Yw== From: Simon Wunderlich To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , b.a.t.m.a.n@lists.open-mesh.org, Sven Eckelmann , stable@kernel.org, Simon Wunderlich Subject: [PATCH net 14/14] batman-adv: tp_meter: directly shut down timer on cleanup Date: Fri, 15 May 2026 11:55:39 +0200 Message-ID: <20260515095540.325586-15-sw@simonwunderlich.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260515095540.325586-1-sw@simonwunderlich.de> References: <20260515095540.325586-1-sw@simonwunderlich.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sven Eckelmann batadv_tp_sender_cleanup() was calling timer_delete_sync() followed by timer_delete() to guard against the timer handler re-arming itself between the two calls. This double-deletion hack relied on the sending status being set to 0 to suppress re-arming. Replace both calls with a single timer_shutdown_sync(). This function both waits for any running timer callback to complete (like timer_delete_sync()) and permanently disarms the timer so it cannot be re-armed afterwards, making re-arming prevention unconditional and self-documenting. The re-arming property is also required because otherwise: 1. context 0 (batadv_tp_recv_ack()) checks in batadv_tp_reset_sender_timer() if sending is still 1 -> it is 2. context 1 changes in batadv_tp_sender_shutdown() sending to 0 and in this process forces the kthread to stop timer in batadv_tp_sender_cleanup() 3. context 0 continues in batadv_tp_reset_sender_timer() and rearms the timer -> but the reference for it is already gone Cc: stable@kernel.org Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- net/batman-adv/tp_meter.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/batman-adv/tp_meter.c b/net/batman-adv/tp_meter.c index a3593d104caa5..1fd1526059d8a 100644 --- a/net/batman-adv/tp_meter.c +++ b/net/batman-adv/tp_meter.c @@ -401,13 +401,7 @@ static void batadv_tp_sender_cleanup(struct batadv_tp_vars *tp_vars) batadv_tp_list_detach(tp_vars); /* kill the timer and remove its reference */ - timer_delete_sync(&tp_vars->timer); - /* the worker might have rearmed itself therefore we kill it again. Note - * that if the worker should run again before invoking the following - * timer_delete(), it would not re-arm itself once again because the status - * is OFF now - */ - timer_delete(&tp_vars->timer); + timer_shutdown_sync(&tp_vars->timer); batadv_tp_vars_put(tp_vars); } -- 2.47.3