Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp402687lqo; Thu, 16 May 2024 09:22:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWFtF2psH6dNjor5+HennE0FXNusu2cbj1lnp5hqoEZUCsQn1J5h5gXt4Rw9hBy53VqlxWPyKCPc7HSBu8fSIhTBc8Ie/wc4QPly5vMfg== X-Google-Smtp-Source: AGHT+IGD1SbdDzvoGjObsCZEWj02Pq4dCXWnKLNnKJJLVx8F34ymje9heYFRv1RT6ZyNX3yLYpJr X-Received: by 2002:a05:620a:f96:b0:792:c5c7:e914 with SMTP id af79cd13be357-792c7578f13mr1979710485a.13.1715876572788; Thu, 16 May 2024 09:22:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715876572; cv=pass; d=google.com; s=arc-20160816; b=tizkS2bT+tw/N1NxUH5ixmyKD0qK5SA6Ux/t4qaVEh7WScR9hBHYIDFvbWGRLbCHQ1 JiJigzwfmLMYVin5Ph5q5qIiI8EkvBL1W8W/6RvbSNYkQULbnDzTlQre/mTJrTlXW3GO t3Op9RmD3IISLJVPPE0PXexEktWFvBnCmuhKUa7REhav16CB/5975c7kud0GINg7k/fy xAXqJY8lJrb9UmZcpPoQf2s+P31pgmb2oCSc1vZUWa8UBSlcE6llTMxOCmM306Xrn4Yn dO5OsfWYpzTjjwtTyZ0SWuyKs8UsQjMW+FBO3HxOM8S39p3Rqs5v5IplJd/45A5anZ6A Uskg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2Whh5DjtIx/bucX5mjnvOLaK+szpTem5ldytlDXi5J4=; fh=wFTZxCMOx58qU7TkHuY/5F4HbwORjUAzp6q1P0k0v2E=; b=FWEYNCocUQsfcplbTs3yJoWC+8jW5RYR8THwU5Lm9fLvw9h7q/D71LWMf+PGKW5xqO 0Bau3pD5DXfKyTqMZp5n3c4/+lqq0xK4I5/00FSeZzRzwuprGakIENM9x4cpUSIrRE20 Eujp0WBKa4KsVMTRtjTj1u61pRgXPJkZFkS4Kmz6FVBhbNhkqtdta2xvrh/Ty5WorInd qaWdIVw/I5N5yF1VM5XynmE4WiXHip0mH1M7BwI7QmVOi1q7REZe/mjBwRXW86+hIK/m AR5OgbD3JIU0bpnHsGrmGI+XCTvtxdMPN4vRmCWYi5bWjQIwUh1w0662eYCtBcEZDkmB wwTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hYLuVycB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf33b285si1779706285a.398.2024.05.16.09.22.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 09:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hYLuVycB; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-181306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 859A01C20D1A for ; Thu, 16 May 2024 16:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88C0914E2E4; Thu, 16 May 2024 16:22:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hYLuVycB" Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (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 8109B14E2C6; Thu, 16 May 2024 16:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715876566; cv=none; b=dx5C91aGVTc7KmcsFPosSKMbHMrlYcFg+I+BajbBad6phdp/nHHKJLpF8i1mdN8hf5DyK//ZS9R3uaPCI3VHbHQuRkZJsS2kXgXiuq6vLywKLI5mY4ecbZmD9fbZDJs3Nn8QIe++yd/i5/jWN+nWeCCPPQAk1iJqefS5VWR3/DI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715876566; c=relaxed/simple; bh=gb1L4jLUSU1Zhbih/GLlnGjB6dmrX3ukdfokLAn+Xss=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xj/7t/HtyieXWoWJMfZIMToiSYg7rrpVbPKFcPb3CyzXedFT0CHn7V0l1Wai30snkcGrKnIL9UB1RFkpVgpczS3Fwg/Q79+gMO7tdO4nFc7XWE5uwml8d6SOZUp+Zw5bO5GzdK8uDHOpApeM87+KL/Q7OJIq7SD+trSjUvVDucA= 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=hYLuVycB; arc=none smtp.client-ip=209.85.210.180 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 Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6f467fb2e66so408955b3a.1; Thu, 16 May 2024 09:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715876565; x=1716481365; 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=2Whh5DjtIx/bucX5mjnvOLaK+szpTem5ldytlDXi5J4=; b=hYLuVycBTQqa+dfQykSC221T7T4zVYnSmJGF2hTm9WOy+2qhEnoEssFT3EJDccRWZ2 eSt45Oh/SFEzhaFsrCqC4Qjc2PKPhq97F5s5dc1+2gkDe6Xo5Z4I2rW3Cf1nQzPyKB3l FKG8ftPDb11T7558zM8Dgao0V/R6x4vX78R654SM50GMPTQ0+8aREi6ckLqnI+VC03bQ NBr2kA3kFXWVa5DpKsMlnnZz+R+ooSSE+ZkTd6pIIFnVAxfOOHYQ8XOB1JGC3lGYLXGv ptWArH5ypvU1/mrsVPaY1Ao+9abHGqzWzv7EDoix2JwZZsNuvFa4wemT+PkoplDafJ0J 9KiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715876565; x=1716481365; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2Whh5DjtIx/bucX5mjnvOLaK+szpTem5ldytlDXi5J4=; b=E45s6W+NhF9ZpDxAY49bHlmEZPCwaI/RkD6xloLQOJAFaJGTQFDrTDgcMUnNYihVCa 4R6XvzeUYUhHJ/hktntpQY9x9HUk6N1Bz8REV6En3+UC6apG2y90YXYfp62l+iCPB/1/ Vy5gKQQ7daZO6AwOlgjGdnXJi0RCca8lOWF1cFI6bRTkMQWKxsHEg7lpRhr5aSgxydLr BaEtoN5fr10Fg6tzQD6CGCQ+6UBkL/HNQT7GkGOjBD2NSl7OH3AHK4TB+TBcN3zOawml M1tBXt699+wEcdfr/lUf486cFIF4dSVLdWYsiJJaR31Oo+QY9d2/BrEDuHVGjg0hzH4i tBSg== X-Forwarded-Encrypted: i=1; AJvYcCXgUCvbrekKNSvERaZgI5Ef3OwWXEIhjqWdKubQrUBGHpC37Bw50FLTgnNwJgJ3l3RWNCyG1kH1ITnzsE7n0wE/uBGUuD47gddYLwP/Qhobs0y8JA6ML/MfP/6+l+jNqIqc0uOXGOGeZQ== X-Gm-Message-State: AOJu0Ywa2gImqOVzmArPpND3ifz7gUeWDFhcgXvbp+1LRdg1er/mxT42 RThbBNiEzeBvW+peRAA/oqvoR/PtnsDV/NpqvlLHIZ/XNW3GDaKNIU8Lkw== X-Received: by 2002:a05:6a00:1ad0:b0:6ed:1c7:8c65 with SMTP id d2e1a72fcca58-6f4e02aaddamr24423770b3a.10.1715876564631; Thu, 16 May 2024 09:22:44 -0700 (PDT) Received: from rigel (60-241-107-82.static.tpgi.com.au. [60.241.107.82]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f676723725sm3505702b3a.78.2024.05.16.09.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 09:22:44 -0700 (PDT) Date: Fri, 17 May 2024 00:22:39 +0800 From: Kent Gibson To: Hagar Hemdan Cc: Norbert Manthey , Bartosz Golaszewski , Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] gpio: prevent potential speculation leaks in gpio_device_get_desc() Message-ID: <20240516162239.GA184911@rigel> References: <20240514122601.15261-1-hagarhem@amazon.com> <20240514124221.GA76024@rigel> <20240516125742.GA14240@amazon.com> <20240516145540.GA116534@rigel> 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: <20240516145540.GA116534@rigel> On Thu, May 16, 2024 at 10:55:40PM +0800, Kent Gibson wrote: > On Thu, May 16, 2024 at 12:57:42PM +0000, Hagar Hemdan wrote: > > On Tue, May 14, 2024 at 08:42:21PM +0800, Kent Gibson wrote: > > Now I need to test your patch to see what it actually does. > Tested. Fails. It does what I thought it would - clamps the offset into bounds BEFORE the call to gpio_device_get_desc(). The appropriate place for this fix is in gpio_device_get_desc(), after the bounds check. Cheers, Kent.