From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 C607022083 for ; Sat, 11 Jul 2026 09:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783761699; cv=none; b=D6C4hMsEuXA117htknb/FAqK6VcftIbtzSj/uef1Np11ya8LsZjVW9tU0bHprseUCk1PrVN0HDvu52w7JwT4gyVwb0qwmWQlorZaI5dCi/DsO4AXa+BMqz1NTOLu4K1qwccUTCGmoHvRASQKW1SRsmTUHA1EExykPZv9VUtxxyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783761699; c=relaxed/simple; bh=6Lqq3SsRto1UjLy5iyFR5JFQX+HovWl0jT8mWHPbsLg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=L0Wwgtt86lq8l+7Vp3GTB7LXM8hP//I3Q2MF8593ygfbKyt55/1oSl+0S8QN5+/sy9PhARFvlJilnAgcqVeFqMsdPJRAhd69RMjBWbvtG/kKagntLFetSO6E5j44tFJqQmT2C8Ar66/ODBQP3GvhokYc+FkEyWyIXrVQQiB69SQ= 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.210.181 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-pf1-f181.google.com with SMTP id d2e1a72fcca58-848743155bcso453508b3a.0 for ; Sat, 11 Jul 2026 02:21:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783761697; x=1784366497; h=content-transfer-encoding:mime-version: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=6AJTvwyhcXvY6PQwSFo4wzuwbYjER1dNCS/K3HQvqUo=; b=EGadg5zlF/VAawujBX7qf7n3UyX23KTuCluN75syvQ33EvLji6Nw9lxm6hZXlSZOh+ /lGUQsJl1FaAtjTLui54Lo+Wq/uRnVL9JgV5QuFTsTIFL5IEXXsyP+7g581M+IHXiiaw Lx2Y2x9hLVffNyHhi4BHxZpebQk1SRkdYYNm8l4oNkMab/cwj5Ip+PdmnXu4AHIH9nUU iwJPqOEe4cflBdSGLJr1XaynXaUmdObWtjAzxJNV5ZjfreRkF1JX8/ft8SpydhJdHEW2 9jkJqP2bnuLKYth89UvABPpDuwwZPrKQdowkb7rK3Eky5UWHXuw7jJ+XNHsvq3ro8N1n v+Og== X-Forwarded-Encrypted: i=1; AHgh+RqrtyErCVwMmuu/IfcN3fDjEj+XK+eq9H8Lc3bJNyRyG2FLwk9fkMlyjzhJMFEZ23qfV+o4h7hpfdZiQ+g=@vger.kernel.org X-Gm-Message-State: AOJu0YwoCoI2CBgsVq1oVMfH3tchi+PYlo1AVan6o97LsQMy/iR/2RQ/ YLVkJLXYTN6KPFOgS1jXge4rZMKJJH4zUHqCzsJrk2haLWeDOsvjW08= X-Gm-Gg: AfdE7ckF220oJx9SZgZRuItrrZQGr2lrAf8+k2xTNOj6nLim53UWsHseoS5mfioqhuI BCJl4oQuQycN2rKostYbP3BHnR5cNfrd04cMwi3Gelpob9Z+glNkYJSVaHsJjsw5CdUrVG/Wr96 bm+VtGbvg4prXiXoNnV9S9c3m2jLToy4IhJ/bKvP/1I/VBxLGNJLI2z2qyItZjwHO5sZaxDlLxz ujiW87e1zynxeffYFv/YHsLS1TA62Ua98ExPG8zcMkSI8BAP8fhMTKY1vrHw1MxmCM/n2xfpbqt IBJcX1Idi4UrbeP3hlPz13YIhqd7QTeE1Xm/dbph89lcMHqTSJ3Yz9lODVgHCl+onZop/1BmjiH 5Wd2qSQMrBAoFFzMhwWrJ1TqA034I/gXvnTP2BiSfcq33UI1Pzwc/owTCnM2/SJtdZS0dpq+2g7 +2yCqcj5l2BP1KFqGn6VcDdp4L3mpbq+bTjoW5cTT6ICmKxtDBF2tcZKoYHU61EAQ2ikEmtU3dx b3JcjXhwWU4/oX16V3lNf9cbA== X-Received: by 2002:a05:6a00:228f:b0:848:3e69:4ba6 with SMTP id d2e1a72fcca58-848896eb4bcmr2198939b3a.54.1783761696751; Sat, 11 Jul 2026 02:21:36 -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 d2e1a72fcca58-847f6dbfd41sm11468726b3a.57.2026.07.11.02.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2026 02:21:36 -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 v3 0/3] Input: applespi - fixes for DMA timeout, UAF, and NULL pointer dereference Date: Sat, 11 Jul 2026 17:20:51 +0800 Message-Id: <20260711092054.13818-1-fourdollars@debian.org> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Dmitry and the linux-input community, This patch series addresses a long-standing DMA initialization timeout on the early 2015 12" MacBook (MacBook8,1) on any boot (including cold boot), as well as two pre-existing, high-severity UAF/NULL-pointer bugs in the applespi driver. Changes in v3: - Added a `force_pio` module parameter to applespi to allow users to manually disable DMA for SPI transfers. - Resolved the execute-after-free vulnerability by unconditionally restoring the original can_dma callback (even if NULL) in the driver remove path. - Fixed the probe timing issue by applying the can_dma override at the very beginning of applespi_probe() so that all early initialization transfers safely use PIO mode, and properly restoring it in all probe error paths. - Documented the Bugzilla link in the commit message of Patch 1. - Format the `force_pio` description style to match other parameters. Changes in v2: - Fixed an unbind/remove execute-after-free vulnerability by storing and restoring the host controller's original can_dma callback in applespi_probe() and applespi_remove(). - Split the fixes into a 3-patch logical series. Patch 1 introduces a DMI quirk and a `force_pio` module parameter in applespi.c to disable DMA. It overrides the shared controller's can_dma callback at the very beginning of applespi_probe() and restores it in all failure and removal paths. Patch 2 fixes a pre-existing UAF vulnerability in the driver unbind path by explicitly calling cancel_work_sync() on the asynchronous registration worker work struct before devres frees the driver private data. Patch 3 fixes a pre-existing race condition in the debugfs interface where userspace could open the tp_dim file before the asynchronous worker has finished initializing applespi->touchpad_input_dev, leading to a NULL pointer dereference. We resolve this using smp_load_acquire() and checking for NULL. Best regards, Shih-Yuan Lee Shih-Yuan Lee (3): Input: applespi - force PIO mode on MacBook8,1 Input: applespi - cancel pending work on driver remove Input: applespi - fix NULL pointer dereference in tp_dim open drivers/input/keyboard/applespi.c | 76 +++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 13 deletions(-) -- 2.39.5