From nobody Sat Jul 25 03:21:25 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 F19923AD527; Mon, 20 Jul 2026 06:13:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784528002; cv=none; b=Zbsv+akdSvfWRhpRsS/nAQFfOCjpatqAu8JUGp4moKWB7yDHTH8XgSvsCsIXFuJbpDUxkchwWKcPFJvATsA+541QV3JKZCOeZ3StUM6XcJ7zP5BZ1M86rYGusYNPgyYcaG6Gb3Kk1sWvbGuE7tJqElUXB+WXMylHGJDDy2xmx8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784528002; c=relaxed/simple; bh=JeytT1vi1byoH84Zq1M7vKlMICV+tdZahM56ereq4xk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lgITaRqNUycamYmbx72N9YujS3YCkv4EGNbjaMQz7jKwdYhnXzZ9L6qERP5kvBnjxVxROSNvO/7lqmV8G4HiwFD2DfTgalPYMix/OOnXW2VVbWxhS9z0RAcd0Cwj0NkQKs8a6hMf4Qr2xTl2MQaH292XpILbcb3N+I0B72y4N6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 13f77998840211f1aa26b74ffac11d73-20260720 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.12,REQID:6562912e-5e09-4538-bb12-fa0caa37961e,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7bac3a,CLOUDID:014beaf8be4a9af332da51fdf54df007,BulkI D:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|850|865|898,TC:nil,Content:0|1 5|50,EDM:-3,IP:nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI :0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 13f77998840211f1aa26b74ffac11d73-20260720 X-User: lilinmao@kylinos.cn Received: from localhost.localdomain [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 1378590274; Mon, 20 Jul 2026 14:13:08 +0800 From: Linmao Li To: Dmitry Torokhov Cc: Kees Cook , Vivek BalachandharTN , Richard Pospesel , Chris Diamand , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Linmao Li , stable@vger.kernel.org Subject: [PATCH v2] Input: byd - synchronize timer deletion before freeing private data Date: Mon, 20 Jul 2026 14:12:59 +0800 Message-Id: <20260720061259.1601281-1-lilinmao@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260720033030.1580891-1-lilinmao@kylinos.cn> References: <20260720033030.1580891-1-lilinmao@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" byd_disconnect() uses timer_delete() before freeing the driver's private data. This does not wait for a running byd_clear_touch() callback, which dereferences the private data and its psmouse pointer. A callback racing with disconnect can therefore access the private data after it has been freed. The timer can also still be re-armed by byd_process_byte() while the disconnect is in progress. Use timer_shutdown_sync() before freeing the private data: it waits for a running callback and turns any later re-arm attempt into a no-op. Fixes: 2d5f5611dd0d ("Input: byd - enable absolute mode") Cc: stable@vger.kernel.org Signed-off-by: Linmao Li --- v2: - use timer_shutdown_sync() instead of timer_delete_sync() so the timer cannot be re-armed by byd_process_byte() while disconnect is in progress (Sashiko review, Dmitry) drivers/input/mouse/byd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c index f5770a3af2f1..5fc3c629590a 100644 --- a/drivers/input/mouse/byd.c +++ b/drivers/input/mouse/byd.c @@ -423,7 +423,7 @@ static void byd_disconnect(struct psmouse *psmouse) struct byd_data *priv =3D psmouse->private; =20 if (priv) { - timer_delete(&priv->timer); + timer_shutdown_sync(&priv->timer); kfree(psmouse->private); psmouse->private =3D NULL; } --=20 2.25.1