From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f177.google.com (mail-dy1-f177.google.com [74.125.82.177]) (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 834FB327C09 for ; Sat, 23 May 2026 05:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779512803; cv=none; b=OrbRnkky46rMvgZmOLqCu8qzDPyyohHXC0Zoab3ke6/u+3NU/9k/UbqmQiAcvwlxbxLC11wHyAp1YcaMyJ7uQwo8FmhkED/sNAn2+BRSYsaobTbNYw7vqJr+Z8/RyDllDL5rFIR2rIxShJ7zAkfRlwTfboCQGC6YFLbR6O9Sqgg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779512803; c=relaxed/simple; bh=khrnOXSh64A8oBJ2XH2OmpvJLC2kKn0IivBd7kZb3z4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kZfPpUfgjy+lIUUADwDxAYu8xQLs9Z+K4ZcrBVMRdxh6Cpt2V/jNDYKIu1BO0JcQqkQEYAgoUMMnC4Ce2ci+wVd6vtJn0Vy40VZg5+h/rqe3uIiBm1iaR3d38YxmsqaINOF178qZunG5SyEpMYk4dJwniCu9x/e4vm9c/xpP47Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C1OVd+/i; arc=none smtp.client-ip=74.125.82.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C1OVd+/i" Received: by mail-dy1-f177.google.com with SMTP id 5a478bee46e88-2f68f3b075fso2129949eec.0 for ; Fri, 22 May 2026 22:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779512801; x=1780117601; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ktEAdZm8Qq2zkDwBfCfBkczTqnA0709P/kUhmmDv8dA=; b=C1OVd+/i4AGkdvJKWuimx+2U8Tw+TgiY0pm85U5Y/KiCq1tMYTUKQHIcfb/gjWscL9 XdYba0o0sq/438RWVjmHTMEaO9F+KmM0yVSUniYxF6YzOf7r7X1H5TRQZdzq7ezhZkPY lJRz3hoQktYdfhgBoxuwFDjSQgBpjjpGlpAJxHvyK3Huq6w1w8cd2NQm0SIJovDaTkw2 IJ6+9z7X/t9aVVuvbsnnWsQ2cmXrmdefFQqC+5p4AHFHEoGnsG4G5jbYs3nlQ742Xv97 wMA6yMW7yTYDHTCKgitXqSB/vdbQDTXw1NrLqgPvHR3Qk3KrQkNUk0T6CaIsmpxoEz6T TfzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779512801; x=1780117601; 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; bh=ktEAdZm8Qq2zkDwBfCfBkczTqnA0709P/kUhmmDv8dA=; b=NXVNw0Gtbe39bRi7XIxZWXbgjnfxRwrrEKAi+1K4CdcmHK1EkbqBqEXVNUzZ0AljJp JlU19WBLpnwh8jlK2yMMA11LIsZdRnZFdAGXDAkv+Mcd7ukutygAVxL3b0l6JR13p8l3 Yb9WB7qHU7KBFsDYWg9skNiI2vOBJU+eYofC7ZR2n9LbrBC2NjgTxm9JIUXLehIK6gbw +HWmxxOulZiFKLFm5W25S0CF6ecwKMRg4nCls/yDPuPfA5j5kH6ROu+cJa+gZIm7Eo0c crsle6FONF84+XZp+eInr6yy1jhxu2ZxinveHO5ktbUYgvjeBtuvn1doJ6fT2UVeTbst WfvQ== X-Forwarded-Encrypted: i=1; AFNElJ/OvviwfvE7JD9MFj7oqe2iUm7SQ6ICzTLKcQ0ZQuNBMSqPisEyRtKEpL1/DldRbkN6LZLsmn9VIOgwO9w=@vger.kernel.org X-Gm-Message-State: AOJu0YyuDkojVcqWTR4NEDnznvbdWj7lNEnB4rFLuT11UE12/c+tYwVe LyaqXhaeQ7EmXIePXtcSIp7lAMYb+aMkozyaNvsjOImb74dEMjXETByr X-Gm-Gg: Acq92OEl42AbDsypGFDyHiDYR608vnaWizzKWOafGwRrc7xsirJkbAttcbNEl9ot/Bh 2P5aQQEG+7sjqiJa3Zm58d8xGAlc8MJcHp/U7psAhzeAm8xYpaSD8JureSbWWVbyehTYDMgK+1e nr7iEMB/XhR6bNPQcEPa43DhWuDd3nPhKrgPZoQLdurZn5u4BGiEPeYR8J5M6UEEnAXLxFJ549u cUkt/V+LMZD9QW9m7Xgu12wSlsRO6qmz9k7uCtd4oHIZaZD1T+3ZH5b00ClZ+9prsddNwHGyd9x Pv46wbY2lGKMZJWx8TcltLtLYS3le1Ln89NeH+NgKOSa/fIYJ3MxlDC+k7HK0S4saUDhx1bVKc4 VmU6Q6c90j7Y/A0S15sd5IEHRGd4w8qRtJjvVM5K0hC0jV/FHITVYQuzdcEaYSVXRINVuGWbfMT Il1VD0ShtCcYq1TKd0Rb/SyYW70BFizF54A72/saTa5LvFj1Rs+xlVMlfv5iN0VSuRoS8Pds09N Q+tPQAyHbag2awa50be0j4biyMTcaSC8Xw= X-Received: by 2002:a05:7300:bd03:b0:304:188d:d0b0 with SMTP id 5a478bee46e88-30449141795mr3396835eec.20.1779512800552; Fri, 22 May 2026 22:06:40 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2a00:79e0:2ebe:8:7e45:2bd:3c86:d34a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30451f3feadsm3502583eec.13.2026.05.22.22.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 22:06:38 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Thomas Fourier , Seungjin Bae , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Sashiko bot Subject: [PATCH 02/11] Input: ims-pcu - fix use-after-free and double-free in disconnect Date: Fri, 22 May 2026 22:06:20 -0700 Message-ID: <20260523050634.501509-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.54.0.746.g67dd491aae-goog In-Reply-To: <20260523050634.501509-1-dmitry.torokhov@gmail.com> References: <20260523050634.501509-1-dmitry.torokhov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ims_pcu_disconnect() only intended to perform cleanup when the primary (control) interface is unbound. However, it currently relies on the interface class to distinguish between control and data interfaces. A malicious device could present a data interface with the same class as the control interface, leading to premature cleanup and potential use-after-free or double-free. Switch to verifying that the interface being disconnected is indeed the control interface. Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver") Cc: stable@vger.kernel.org Reported-by: Sashiko bot Assisted-by: Gemini:gemini-3.1-pro Signed-off-by: Dmitry Torokhov --- drivers/input/misc/ims-pcu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c index 57d917387544..d0934d577b5e 100644 --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c @@ -2071,7 +2071,6 @@ static int ims_pcu_probe(struct usb_interface *intf, static void ims_pcu_disconnect(struct usb_interface *intf) { struct ims_pcu *pcu = usb_get_intfdata(intf); - struct usb_host_interface *alt = intf->cur_altsetting; usb_set_intfdata(intf, NULL); @@ -2079,7 +2078,7 @@ static void ims_pcu_disconnect(struct usb_interface *intf) * See if we are dealing with control or data interface. The cleanup * happens when we unbind primary (control) interface. */ - if (alt->desc.bInterfaceClass != USB_CLASS_COMM) + if (intf != pcu->ctrl_intf) return; ims_pcu_stop_io(pcu); -- 2.54.0.746.g67dd491aae-goog