Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1062026lqo; Thu, 9 May 2024 03:48:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmGMiQBBHzL1Y3ih425rImj+ovjhB76JkuoLAkTvknLThojyjUFvmoxshEfxLqh6Vi3JGWNPgLpfuOHX7a4Y+9nAEjtRgGgShTxFudog== X-Google-Smtp-Source: AGHT+IGeh5Um567bvkFt+TqcWJZyFLFBULmpXAkm++OUvkaLItU54PX/+Z3A+2vftKqYSZNdPJ54 X-Received: by 2002:a05:6102:418e:b0:47e:5c2e:5695 with SMTP id ada2fe7eead31-47f3c39023bmr6041242137.23.1715251701574; Thu, 09 May 2024 03:48:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715251701; cv=pass; d=google.com; s=arc-20160816; b=ZAPuWenCXzAVUtsWDi0rQKsPt6FmWfz4IxKlbHIRdzAFAjCSXldeTaCpUNhH/xysJ0 p3mpTH3f7fTlf2SgPiNTdiNFdWrFk2uLdgV5ZNd96TowFlYuxiMZ455PDC5R5+i/gTEp 18aSWUYScCvmiR9Cnb8Uaf3Cs+T+Yoe1jpt2+WT4be7ZJTDgwzg1PvggOv+5FH+wABz/ O3vHTaw6Ue70h9/c2TsxXa6LznB0655oFVgu7UhyAkCcn264SbyjlvoILzktA8otyWfX DvI3IakCfjzlJXvpFcwgR+N865N5YhrOFY/Gp6BieuAP+iAvrLQt8zEZMkWImP8t/y5U UcNw== 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:message-id:subject:cc:to:from :date:dkim-signature; bh=7qlZtZk75coxcr32t+mJEdsIgCn5e7In21AxtT9MXDc=; fh=2tpOED5LOKN4BHBswrdxTGdSHdmnz4ifixde8wVmBCQ=; b=TVIS87SEQ5KVm99RIPAe2JzvkUVY2MyXkmAlEvvwbH3aHi44CUkp6RCEqu4POS+FF+ 8qdAt/x19c8ZffaARMIGSVjE3crQsR1SIzmZrO38ogEl9sNS9FHx2cbD7dUc/ETxZsPX b33W1wCSisKuMfH9XBzfV9O7o6aKGVKbAhuVhzD3leADnVT6xIWzZFTP8b5nRNBsdjcf NFU9GCcbQ68EdZHdqnWEt/FHIfYMb2cnao41iaZh+HCyzUrQFGhVwadV+IcZ0wzcmlVg /aJsuyAtWRG5UMZUKO9ZSUZ/kviW3IjZHjZYZoGS47YCaOGKz+scjYIJsQSmwtbxC0ER HGrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kSLMi02n; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-nfs+bounces-3218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-43df568937esi10569031cf.398.2024.05.09.03.48.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 03:48:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3218-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=@linaro.org header.s=google header.b=kSLMi02n; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-nfs+bounces-3218-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3218-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 3F3DF1C21423 for ; Thu, 9 May 2024 10:48:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0167912FB1B; Thu, 9 May 2024 10:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kSLMi02n" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (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 492A912EBC8 for ; Thu, 9 May 2024 10:48:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715251692; cv=none; b=q7B9aBWMJmSxetfMDfyDiahPw5Q7V/RUk2IWtF37tGvimV7iNxazx4dLH24X8aHj2f31o/1BpFeXN+/8s16BtUEnWU6IZ/AzaTfwmePg74K3oCDlsn2koQBq2f8Dr3e/uqzDy58o9XUrrVxutDZx4SXjAGKtQ7ff/TZ8dnXqp5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715251692; c=relaxed/simple; bh=EAmmvUuXUCvQhVJyhOjnloUwsHV7hU6+Z0N6I4QkxKY=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=tSH26XW/Ij2XkUlP5M6k1CMakLZTFTlHfrdNDAs7Gkpfc9tOKYlxT5VxAssCcE2AuLs2A07mWisPD/ugooA02BKr+u1KGd+33duqmxxutH0loInZewZlxH8QvvysbGdUTEe+87EsCqBJqQgfh06j8iMMsssntYVmLnRTDG0X1m0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=kSLMi02n; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a59b49162aeso164308466b.3 for ; Thu, 09 May 2024 03:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715251689; x=1715856489; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7qlZtZk75coxcr32t+mJEdsIgCn5e7In21AxtT9MXDc=; b=kSLMi02n7NAwcdlaLMJ0lWD8/Lr9jOYvdvnDDWEf81jzisupG21zC9AkK5LJaqkxN2 JW2TI3pXpHNn4cjfssxNLaMT4cG5MBBaoTt1moRnFdLvyvfv1DlpbMLvlRI2TlR8Qw5d nBYzg7wKRoPcj2WHksU0Jlu0uoyeyNKSIjZ9zJ2W+HUA2nmp7sanhS90PPQ2Ytyr+0ht ug00jlRzAvhVDCnbnaQYo8LtvY2Rx+ellXzC4bA4JbI8Pj3aAeKBamB8bQsT68cxOvJX eiq1bPp9QMECb+BGC9TTnBNZW3JpVqLMUhs05KT49HwsCyhYlyLunA5uKsuGO+UVjKEm HFPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715251689; x=1715856489; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7qlZtZk75coxcr32t+mJEdsIgCn5e7In21AxtT9MXDc=; b=OcSI02w6jkgutkJlfQUOiJNqhUUKwHInzOSAKmVd5sydvGs2QMb+TZHykXkV0qJk0w te9tB+5Kq9MAa1q8puE8mMpHPZkXB91Mi6iQ82APQhy6ftGxPY9VpYUAU/fCGXeX5nMD pMAXEuHEsDlGnmiGMB4uJsUPpnEnY42CA+GDD1yF9seRMMf4Xw7fZ23jGruM73IA7DaH jp6fJfSncfWcx3LMg19dLoq4tAmNj25rFkUOpqY9ZXKMzkS0U0De0BkgWs+eM6DScYVl Rcq006DdJ5QbGs5MpNl7xAUgvgqCl8ZLJfG7+KQ4dJqpxLt/OgghFicutC1wiI8aJ4uD b/cA== X-Forwarded-Encrypted: i=1; AJvYcCV5jHDRngIhO7jt4Sq3Ro33fqtcoLEwBXrVNzkrWRJrCjEpGI4npYWtuxD3GD/FbmhR8CElLt4qli+HxRG8ILO8MDaFAkpxPbFG X-Gm-Message-State: AOJu0YwEaehtUuUKmykYH7slbSQGe7oVRG2tKxtHV5FZK7O6YVFokS3d 1QM4x6E6QJ1el84LfzzIq/2SOp7Nb2d4Stj64NOchmGs98C4wQ/Lj+C26rRGJ+I= X-Received: by 2002:a50:d595:0:b0:572:a7ec:1a5f with SMTP id 4fb4d7f45d1cf-5731d9f1eb8mr3880773a12.24.1715251689505; Thu, 09 May 2024 03:48:09 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5733bfe2dd1sm572297a12.58.2024.05.09.03.48.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 03:48:09 -0700 (PDT) Date: Thu, 9 May 2024 13:48:05 +0300 From: Dan Carpenter To: Trond Myklebust Cc: Chuck Lever , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] SUNRPC: prevent integer overflow in XDR_QUADLEN() Message-ID: Precedence: bulk X-Mailing-List: linux-nfs@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: <332d1149-988e-4ece-8aef-1e3fb8bf8af4@moroto.mountain> X-Mailer: git-send-email haha only kidding The "l + 3" addition can have integer overflow on 32 bit systems when it is used in __xdr_inline_decode(). The overflowed value would be zero and the check "nwords > xdr->nwords" would not work as intended. Fixes: ba8e452a4fe6 ("SUNRPC: Add a helper function xdr_inline_peek") Signed-off-by: Dan Carpenter --- include/linux/sunrpc/xdr.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index 2f8dc47f1eb0..585059f2afca 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -14,6 +14,7 @@ #include #include #include +#include #include struct bio_vec; @@ -29,7 +30,7 @@ struct rpc_rqst; /* * Buffer adjustment */ -#define XDR_QUADLEN(l) (((l) + 3) >> 2) +#define XDR_QUADLEN(l) (size_add(l, 3) >> 2) /* * Generic opaque `network object.' -- 2.43.0