From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f173.google.com (mail-dy1-f173.google.com [74.125.82.173]) (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 C815122D7A9 for ; Sun, 1 Mar 2026 02:26:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772332010; cv=none; b=gOcXj4+htVLBT6eCFcxC8CiYDuo0nfGIbSS7sAJSiHpOlIwROvyxP31IfCT0PMEJcJImDSdx+jkiugwDPqdaBvWzuIOYmiBE1aEyInmtT9BedTVYO/poB8EHHJHGqa0WnkWIo4pMpr3sco07nj+bKsSgRUR6D8icyXn29yuf86U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772332010; c=relaxed/simple; bh=nqwUqgxwJJ/yN+GalM6cyfx43HJVOxHb5q+Fv5inTEg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CiSZG5RVYg4TqYo8/BAtsqvysS3COW3g2gLFzNeVEJciuC/0NTUAwx3wcISYO8nnVD/+C50k3SNOLiOayfxLN9y+W0tJOhbcL97eT9I0pTgkMsmPUnbl4FkqGXlFQQPwq98oD/3zIw3A+XWgryFC5GmF5HjoeIFgDknFPqE6LrU= 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=hCBk4D3S; arc=none smtp.client-ip=74.125.82.173 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="hCBk4D3S" Received: by mail-dy1-f173.google.com with SMTP id 5a478bee46e88-2be06c02f66so415945eec.1 for ; Sat, 28 Feb 2026 18:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772332008; x=1772936808; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JS8GHSNEpRdWIh926KehVaPDhrhy21AYTD/lvFwjhHA=; b=hCBk4D3SyUVXrlsgSHyrxdZj0jl2y1D0WKPWjt+qm0N7VBXy5ktufjfeCseLmbK5Gc 64aw2/rDqbqDONaKmY/U2JP3dt4DYtIfzDWUct+jUj4uc143qBfk7aZRxVcdB2CHMkJI Hz5l1QfD4cvXUSZmo+NPSRHEqwZtVlMeIslMznLoPWlVyCsjFbYto+sIKJweB+sHEqJq 9R9wvM1EGUh43+OCIAOm1mrqYLy2e+MegY+lTpRA2YBOXBBDsEx7sLZ8IrPxTizwS8oi kVbyMY1SCATCyauZJkfogXRLVvs/BXPmIwPv4vwp3XvIlQRGrB7CbqzWJWh0RaL/aHJ5 ZmsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772332008; x=1772936808; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JS8GHSNEpRdWIh926KehVaPDhrhy21AYTD/lvFwjhHA=; b=u4/ag64Lfbb4vKY+WyZJfaBrrG25UP2uFg+961Qc+0owInN5MNbk8kNgua0NvADmrs rrIHxvo2tU5KmvZuv4pCPidUnaVVIhUGdGN+DHJoqtsc+fS9vuIEd2i8dAcZf/zt+vad 8vA6qjEj1RBlopokyFIAH/oJh3rPMPOq6xhBwcXk3xOOaWYqdcbOev51hKu11xgnlzUA 89I0MEOCABIX7vpyI+Iy5UJ4iGKDEs9c6JPDGAUQLJqIjPCiYFx6UQs8dD+F21a2roYe HlTKeMs+RNVn0wZu6hXzwy71FQyGzm8TjiHTEXSPFXxZkGJTWho4c/nc4RVe1UuEQLxz Zs3g== X-Forwarded-Encrypted: i=1; AJvYcCU9dmHb94ffo0v78udiBdWl3F4JdwATnRd97yW3oead/6Lba1ViIQvscW6cHzbi111bH3YbI5pbToaQrTc=@vger.kernel.org X-Gm-Message-State: AOJu0Yx4+cjKrerqdasWpvbSoQhdN/l9kMW/vRLgVrLaqRANO2MmMe+l xw58LwMgv2JkPc4FxNQT33J+WQYvHL+qd3+rfvMO8iF51fvMsxJ+3dPP X-Gm-Gg: ATEYQzwG5o8r73x/PjHh0MvAKsK/oTm4Zxbu7CZyz1v1RwCD77zV4cArW9sd/o8/dqe 4mEz73r16Omx21C8NspgMkltZCuhJSSZ7/CYc3kljanm7HxjPM6Kt62kHcB1FLeLwYeT2x1R953 FjTutsXke213IGwojf6sWcEEunv+L8S/l8/2+NUUhDAPVIh4WmSk07yLCrOk02tE3fnB1Zgf7xY QxbKInTyT9hBeJ1DXN0RnhzTJS82ywBmrfkkEoJsueZvm7V616Dh/1egKo1U9/hDRAoqKbSJvAW GXaVH2dUW3dDOSGBPQP0nc6qGcy7TGN7y71kD1ifSKi0KyAGLcZtbO/kTDYfupGNhOBCfJHkfZI 4Zucm19Ws+cg0XUWvafyVCH97ObpWZ9SzPer1oEcp0CsOWRP6wxTvZZotAY/xRWC5OFh/+S6X6+ KnPQkOGot89GqGCJ4zwFHnWf/bmQcAJVKOfHtDL0Zz9+kTW1Gsztr05IuYZzBtkWx/ X-Received: by 2002:a05:7300:2325:b0:2b8:66f3:2502 with SMTP id 5a478bee46e88-2bde1c0e786mr3671982eec.1.1772332007745; Sat, 28 Feb 2026 18:26:47 -0800 (PST) Received: from google.com ([2a00:79e0:2ebe:8:cf71:43a0:f3f6:e5be]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2bdd1f48c77sm7521132eec.26.2026.02.28.18.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Feb 2026 18:26:47 -0800 (PST) Date: Sat, 28 Feb 2026 18:26:31 -0800 From: Dmitry Torokhov To: Ariel Silver Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Subject: [PATCH] Input: atkbd - validate scancode in firmware keymap entries Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Feb 20, 2026 at 06:33:55PM -0800, Dmitry Torokhov wrote: > Hi Ariel, > > On Fri, Feb 20, 2026 at 10:44:28AM +0200, Ariel Silver wrote: > > The SCANCODE() macro extracts a 16-bit value (0..65535) from firmware > > device property data, but atkbd_get_keymap_from_fwnode() uses it > > directly to index atkbd->keycode[], which only has ATKBD_KEYMAP_SIZE > > (512) elements. A firmware-supplied scancode >= 512 causes a heap > > out-of-bounds write that can corrupt adjacent struct atkbd fields and > > neighboring slab objects. > > > > Add a bounds check that rejects the entire firmware keymap if any entry > > contains an out-of-range scancode, consistent with the validation > > performed by matrix_keypad_parse_keymap() in drivers/input/matrix-keymap.c > > for the same "linux,keymap" property format. When rejected, the driver > > falls back to the default keycode table. > > > > Fixes: 9d17ad2369dc ("Input: atkbd - receive and use physcode->keycode > > mapping from FW") > > Reported-by: Ariel Silver > > Signed-off-by: Ariel Silver > > Cc: stable@vger.kernel.org > > Was it observed on real hardware or this is theoretical? I do not think > this needs to go to stable, but otherwise I will apply it. Queued for the next release, thank you. -- Dmitry