Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp782256lqo; Fri, 17 May 2024 01:01:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXoz/42dC35rc3cO1GSnnP0QQIpnC6OxTFsrH6WdJ5OUKsUQeQ6ivR0K8Ebr92yO7lxlHxzvfns3pe1zSm9GA2pgqB73SP1WH4Co34wEg== X-Google-Smtp-Source: AGHT+IGAYRp4RJY6Ah2OdylF4ckhnss9LbGg2VBiARVi4oetAJnmLkgURFqSRzPc3rwsDeUbBCJB X-Received: by 2002:a05:6870:730d:b0:23e:6f11:85f9 with SMTP id 586e51a60fabf-24172c2fac6mr24905539fac.33.1715932913474; Fri, 17 May 2024 01:01:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715932913; cv=pass; d=google.com; s=arc-20160816; b=H1YUWrok2uKI/yBJN+zawae3luzIUgMD1FcE5x6ENXPxl0ilgLO+N1fxJebkZ4q7AZ JIK5L/l3DUChfPmyfE6VeZGwrnHYaioOaH6QXYcaUOrWk/hUIJc8vwZzCG4WJ4sDVYSJ G6U4xRP1i/InAnllxP0FI9MTXp5HSK03ZoD55m2J+6Ql2NwmYqhA9yJoY0jmoqCubz4l rQuzzUm/A3VcCEO7/nowrSLsSsnkcUgcUZo6f9fPdobf4ZxepxCg2Ez8dpCfFTpCp3Zx PWsTnnA2/NAyN9n+6kXZCRPrdxYhAQtyV21cwOthvQDw2SAxvc76069W/t59ECVVY8r5 kIxg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent: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=vm22BVZO7WVhxQCWzSyuBh1sHNc/VQxR59e5eUx+xd4=; fh=Ct4z4IO4REoXVVC46MwzLvarQ2GJCTE2LHhhOqWJcAY=; b=BA7YeAWJbPlNuC2uoQGjLRW2NnQfPiCkiKFZezMSsK0Jpl4lqcDXkUJbFIXdtHQnih Ch1PMiQJShOxaRczgJuEqj4BoNmjwREOdwFLxM9r4LDkK/1vDP9v+BuDFxIWcRohy+Fr l65JPEOOYoNhRzUv711K5VKXg76oEsWLByKt5cR+pPc+r6oTdsAQMrIiiL/0rdQbv2rC pxK10RZ2J14mOPJeWuLWoUw+Rxhv/HyExvuri3zxfKv6vk0bBwSTzKod1ujNsziigjR5 2ATUX4aOCtM8A/0qAV/+ymVceIADjTRM8YMQY5Rkrj1HdbhOzu3aXU+nkaDXM9YYLfb3 5GMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=k3eoWmSs; arc=pass (i=1 spf=pass spfdomain=amazon.com dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-181840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.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 d75a77b69052e-43df566f9d0si182728181cf.279.2024.05.17.01.01.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:01:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181840-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=@amazon.com header.s=amazon201209 header.b=k3eoWmSs; arc=pass (i=1 spf=pass spfdomain=amazon.com dkim=pass dkdomain=amazon.com dmarc=pass fromdomain=amazon.com); spf=pass (google.com: domain of linux-kernel+bounces-181840-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181840-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.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 337371C21934 for ; Fri, 17 May 2024 08:01:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D745018651; Fri, 17 May 2024 08:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="k3eoWmSs" Received: from smtp-fw-80009.amazon.com (smtp-fw-80009.amazon.com [99.78.197.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C63112E62C; Fri, 17 May 2024 08:00:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=99.78.197.220 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932861; cv=none; b=rD74SmuDRa7qqfNrs1zwZFoP+BPqyTpmxe4RqE7uy5FUXidopz6djKo2cehGnDjRSiwuewtHYx34feA2Ews3Y4m36ReCgZ/FsTP4OiXT1B+5esQ4TYUK7/W7wqCgesy+GAx+o9dQS7C7T+CzvoZLeHsIXajenwHgrqvG4ipY8+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715932861; c=relaxed/simple; bh=Vdoo6QU/u39c9Rgl96CtP6qcbMot2KPUxgfcFSgZyBI=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tq+pR/kSgE6TkYwJk8tRVjRONhfmRDV3FFipGRSO2zpv0QB9B5pCLqQqhKoS6PBbUJFKLgal34mW0a96HYiaTtZB5rm2rt/G2566/067ZqZW6k2Zm8woutCnEbrEUmKdxdlahdQlNZvdEmtEuhs1jHs8fYFDQeBOit4RqzXVFCg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.com; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=k3eoWmSs; arc=none smtp.client-ip=99.78.197.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1715932859; x=1747468859; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vm22BVZO7WVhxQCWzSyuBh1sHNc/VQxR59e5eUx+xd4=; b=k3eoWmSsD4hZMAzQad/QUuCfeJvJavE2aFhdzP3v/u44N/uhF68VFZ8O 3pqmmSqE/IHdWEEwOaplIWNXFtvmEQEmKHRA1RP4MROnsURM7mcpopkrQ 3wDMgIQG/kGd6M/XG+YQvFTcp/Gp9o5smWtlA/Gj5v5oLDEtGCzEsBUy4 A=; X-IronPort-AV: E=Sophos;i="6.08,167,1712620800"; d="scan'208";a="89887872" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.25.36.210]) by smtp-border-fw-80009.pdx80.corp.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 08:00:57 +0000 Received: from EX19MTAEUB002.ant.amazon.com [10.0.10.100:16909] by smtpin.naws.eu-west-1.prod.farcaster.email.amazon.dev [10.0.18.108:2525] with esmtp (Farcaster) id 8a5c4799-5210-44e6-a13c-cf4505886cc0; Fri, 17 May 2024 08:00:56 +0000 (UTC) X-Farcaster-Flow-ID: 8a5c4799-5210-44e6-a13c-cf4505886cc0 Received: from EX19D002EUC003.ant.amazon.com (10.252.51.218) by EX19MTAEUB002.ant.amazon.com (10.252.51.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Fri, 17 May 2024 08:00:56 +0000 Received: from EX19MTAUWA001.ant.amazon.com (10.250.64.204) by EX19D002EUC003.ant.amazon.com (10.252.51.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.28; Fri, 17 May 2024 08:00:55 +0000 Received: from dev-dsk-hagarhem-1b-b868d8d5.eu-west-1.amazon.com (10.253.65.58) by mail-relay.amazon.com (10.250.64.204) with Microsoft SMTP Server id 15.2.1258.28 via Frontend Transport; Fri, 17 May 2024 08:00:55 +0000 Received: by dev-dsk-hagarhem-1b-b868d8d5.eu-west-1.amazon.com (Postfix, from userid 23002382) id D32C420C24; Fri, 17 May 2024 08:00:54 +0000 (UTC) Date: Fri, 17 May 2024 08:00:54 +0000 From: Hagar Hemdan To: Kent Gibson CC: Norbert Manthey , Bartosz Golaszewski , Linus Walleij , , , Subject: Re: [PATCH] gpio: prevent potential speculation leaks in gpio_device_get_desc() Message-ID: <20240517080054.GA12268@amazon.com> References: <20240514122601.15261-1-hagarhem@amazon.com> <20240514124221.GA76024@rigel> <20240516125742.GA14240@amazon.com> <20240516145540.GA116534@rigel> <20240516162239.GA184911@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: <20240516162239.GA184911@rigel> User-Agent: Mutt/1.5.21 (2010-09-15) On Fri, May 17, 2024 at 12:22:39AM +0800, Kent Gibson wrote: > 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. > yes, you are right. The speculation macro should be after the bounds check. I missed this property this time. I will fix it in v2. Thanks, Hagar Hemdan