From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 874801552FD for ; Sat, 11 Jul 2026 06:54:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783752882; cv=none; b=AgE29oFS9upzoe3xt37TZZOwhpZH3DQjCgmlo18slp4sQA6atd4Xfn2eAdYHCfFNN7e7+CBIvm9SOOZelIRi3mTdHaPonQ0iRkPvwGtM2h9rHEuDdvqKAL6US8DbMVuljaF6QqWUKFhtfExoN53n77o7hviaMoweBHRVOLHGLi8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783752882; c=relaxed/simple; bh=D8yYnBi2xWj5LQjMfc8OYQDCU1x5mJJfXM9RShn7Kro=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cxRX3OwTsuQDZlogBe9/opZOEEGW+wQEzQhPl5D6E24vAngn1s/Vk167gQzu9OoOJgZ/Tl/2SgVmkkm82GrVTtsRY/1FfxLgyAcgpEeQ2mNts8t8mlpGEaUasyihRou/jPECxcXNwbJ0U2Rqbl67YSs9KIN9I/ds3eK/LbH7ZWM= 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.178 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-f178.google.com with SMTP id d9443c01a7336-2ce87c7e3bbso15552595ad.1 for ; Fri, 10 Jul 2026 23:54:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783752881; x=1784357681; 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=NehpXHsDwbbOd4+3jJr5pKlNjm8Jud+jtN5wBuDe+jc=; b=oOKIT1Twr3OSB5B1AlN5oz8c0OHygsmyNB+XECCZ1SZwBGBLtWneHm9IrVo8iiIVt/ t4m5HyhJfufTp32K1EJVrM0AW7uCq6+k2M816S1RAbjhdS7D/cfQumSe4aJMCod3PTWU Jbv8nKAKdfze9eX3Hy89b2KlGpPAwskhC6so22WDHo/LhiPBb6Qnvn0ljhPQ8W0gfCaB T6s1vYdxzTy5dH6iOQ90ZQUlVlAZGgkQZcWxKND/f5W7aI/BZEkMT36rCWDgLzSFZLqv ZQnwwHM7qJnEiA8AeUI9VZPKacLVtMS+xy93Whd74XihjNKNSekw78jbHL4oaxMdauXF xBiA== X-Forwarded-Encrypted: i=1; AHgh+RqzeoilxBZ5dAy9jhumrTGqCZJtZgdjUJEOIK/RSWSgUftFUpYgpqFiS6xG7U5Rh7NJUNIAaTcpXQrzXq8=@vger.kernel.org X-Gm-Message-State: AOJu0YzY9aq/Qiq0C/ndJUFSjvqE9M/QztJSJ1UqJajio8miV7y1Pfh4 VkR6KbvGqsXuCZRz+fmpN+YNJSc0Zh9iDsRqLfX7MBCe+7juBbhZCWU= X-Gm-Gg: AfdE7cl0xeG5CtDyAHGnpOlTInOCw53NkAhgE0VjzZKgvgj3kWbZ7i66pR3Iv2Rmrzt bJo3C+f34rlzon441Gr4Nh1cBz+Z8ZLT/1n3wgrw+CZBnNLYd6joja7Y0KP2J24grTahr9DxSzt WI8UdmIhts7AgmjkgY7PtKobfOYwYSOwZlPME5C2CVRJ4Uk5BUJrjgpjA1D1GKBOZyXhxk52HS+ PHXFfZAjZ7CI2tqSVdaeTGvWMgNAJh5oli4GFb4cTSWKmZFeYXZPyXFpxqAq/F5SE7vryHBdAmB 4v34nLRBqa5rqqgV9EbzJvvRS9jzrSq8z0A5AK6uRN+pzK5sr213T4kXrXQ1Jgo5H5Hzl0m6DQc jsggAFTa60Y9bqw/3hx0LEWSGR4i3nneAeeTqhTt1heAASSBKmCs1h2BB7UeA/vh2txYBA/uymO ZVTvHUw/6eMBP3d+U5BKGNkJVIM/61Xvgn1nXBgvW+vuBfdVq60z3fuz9Qu+OrVAIwJaHIDrHzW DJwaUPLJV0Dienutq6d4S4/Fg== X-Received: by 2002:a17:903:2f0d:b0:2ca:304:f93e with SMTP id d9443c01a7336-2ce9ef1bd48mr21133375ad.22.1783752880825; Fri, 10 Jul 2026 23:54:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2026 23:54:40 -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 0/3] Input: applespi - fixes for DMA timeout, UAF, and NULL pointer dereference Date: Sat, 11 Jul 2026 14:54:12 +0800 Message-Id: <20260711065415.7396-1-fourdollars@debian.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260711055247.5412-1-fourdollars@debian.org> References: <20260711055247.5412-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 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) as well as two pre-existing, high-severity UAF/NULL-pointer bugs in the applespi driver. 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 the MacBook8,1 DMI quirk and its unbind safety, Patch 2 cancels pending work synchronously on remove (UAF fix), and Patch 3 protects the debugfs open handler (NULL pointer fix). Patch 1 introduces a DMI quirk inside applespi.c that overrides the SPI controller's can_dma callback to a custom helper that always returns false for MacBook8,1. This forces the controller to use the rock-solid PIO mode specifically for this device. To prevent an execute-after-free vulnerability upon module unload or unbind, it preserves and restores the original can_dma callback. 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 | 38 ++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) -- 2.39.5