From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD8212FB97D for ; Sat, 11 Jul 2026 06:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783752886; cv=none; b=uwCxcnzIcOZK0nTWfkOk1bVpSBpQzWyunRZzZlB2qrgEvAvtSD5QwonPLlDNQlPBmCk6EnAr6Hy/BAB20KNpk4tsXofpAoPKvscLZhiDPS3L6XFAdrBKfjkBqi2JIL8h/z8RfrVBTIm732q+6P56gR5EIXe6yhi7yfOcoj63+R8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783752886; c=relaxed/simple; bh=hGG1QqmsXO8DZa/raxRUemdtxRcLvOuVWVFaisUeLkI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=k/Rz4MYYxPjqdlzAJA6HIp4LKbq6lDFAw7N9FTtCuGW1gcYuTFqwy7AAtCBDivFIQ8dRx7Sk3o/bTkuyB95biQLCMddJEa/MiqDyey9MrQ5n6RHBO/zivtztY0du3yojaP1Z2bK8J2IeFmUlaF2CafqLtL7T0AiEVuVJr4SZDmI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2cca0c5799eso15936445ad.0 for ; Fri, 10 Jul 2026 23:54:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783752884; x=1784357684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=elcaEIBrAdy5k816lVEGPLULCsTSJKI/r6Pi3p4N1Is=; b=qMpa4WcJsxxEI8nS5aIK42InbOzAJ4F45/yXc19KFf4cHcsTKT7MXEg9dqYWcUVsKb LwpSI5Dh7Dm85pNG+fsiD3jyyySC1E6qPQwpIw9ZivPeaS2nCChl9oh7uexVE7BCJBwX azFGlsrDvnQL0qLp6n/H0Ez9moeTfdFhcKJ814paJXmIe/vIQZHvlDD8EJzoEuYcfgbt MA3v59a0CbJilP4ccWrHotLqp6IjpyxJ6wqbDnWzOGYeVGwl2VTK9RXKv3yK6uPYIh1J pPxyPsK20v+mXGUHo6+lIC01nP9R3hSVSqN+24fgPilaT6Afq0xTbzFr/tJn3U4fZY91 3ZIQ== X-Forwarded-Encrypted: i=1; AHgh+RoVCuGaPdAFxW4B1MwZUSU55lLrHTUNDylO7bsrWZ/YU3nZNCAwtrvf7ZeSgk4AJm+UOXDgiBpOdKq2SRc=@vger.kernel.org X-Gm-Message-State: AOJu0YwHcTFa0tL9QQo2Iz7xXPCIWBkjdSnt3yoilCmV6+BGCy7fiyqS aZvHs+SZbaGAMnXucyLKZNjk3hnWzKn8Nch8h4eFIGgz2B1Nb2X2+On1t/1Cd14tMBbS X-Gm-Gg: AfdE7cnIm1pdBpzu7PagjvtG98ZhBp7FTFgxwhU9sETNV4spguWFGrua+dAuS57cBnL aAsTUs+flxF7BCcw0K6l7C56WKD8y6OD4gPbNHqc7vzCWa1SUUzaQw4oA6dG9f2cu/T1Jfcz1nO Dlx9pvj8EleGCD9M/MehIBvmCPzc/Gei2YkqpNLRuusPw4mqMZBImpRe7W6prsNLMnDRUczDGhC qCLjpNPq61zoP4aizNccpVTfQCYifNGOAOMikWVuoSrLie9NjEGvT9IUOm+YZMHSPlQ5z/+rjnW 01Y+Ii+ycAHVezUr+Es9Ah7KJDTgij6CJ/jIDIf0ch6ANiLEoqtJmm+uFTnhRseYgcrego9AbXJ EWxY5HIJuzY1GQWQHmBwSphsiUQjPqhvmE+wOT52JJ5MZopeGaaJI8jnFqDqk/5Bn6vMXw1gQ+3 A0lNGl8dUT4aSFeNY4W/BOLVakjAKwKc90BoH4CzC0my/Iw4sp1680k0EhFNysNLwWue3FFt4r4 d2xiwHb1An39cmqfCWjlGUxSDeGMn9a9jmD X-Received: by 2002:a17:902:ffcf:b0:2ca:d873:3b34 with SMTP id d9443c01a7336-2ce9f3b3933mr22477795ad.36.1783752884190; Fri, 10 Jul 2026 23:54:44 -0700 (PDT) Received: from penguin.tail0a1999.ts.net (61-228-52-13.dynamic-ip.hinet.net. [61.228.52.13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ce8f5183b9sm18272535ad.5.2026.07.10.23.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 23:54:43 -0700 (PDT) From: Shih-Yuan Lee To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Shih-Yuan Lee Subject: [PATCH v2 2/3] Input: applespi - cancel pending work on driver remove Date: Sat, 11 Jul 2026 14:54:14 +0800 Message-Id: <20260711065415.7396-3-fourdollars@debian.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260711065415.7396-1-fourdollars@debian.org> References: <20260711055247.5412-1-fourdollars@debian.org> <20260711065415.7396-1-fourdollars@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit During driver removal in applespi_remove(), the managed private data structure is freed by devres. However, the driver does not cancel the asynchronous work applespi->work, which registers the touchpad input device. This creates a use-after-free (UAF) vulnerability if a pending or running worker thread attempts to access the private data after the remove function returns. Fix this by explicitly calling cancel_work_sync(&applespi->work) in applespi_remove() before cleanups. Signed-off-by: Shih-Yuan Lee --- drivers/input/keyboard/applespi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 07a910cb8459..b6b4d258d0dd 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1847,6 +1847,8 @@ static void applespi_remove(struct spi_device *spi) applespi_drain_reads(applespi); + cancel_work_sync(&applespi->work); + if (applespi->original_can_dma) spi->controller->can_dma = applespi->original_can_dma; -- 2.39.5