From nobody Fri Nov 29 13:22:29 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 58E43FC0E for ; Thu, 19 Sep 2024 08:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726735842; cv=none; b=VvNayyr2fFR7wLt+MejLXE/PAIPj9ePzij35NLPwHG+4VFLfeG/8OjZ0gM96GDO6NXTq4wX49FJYyqdkq+6SLxympbxBdrIdaoWtBaxsNxzuKHWYHhhq6cx+mqRlJJXYJYsjf46VhAXceaKie4NXOgm7eUp/lSiwXEhAYXfeGR0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726735842; c=relaxed/simple; bh=LrJw1AhJz7sTYbKD7COLqvtv/WahjF0UZSPF3n8L1AQ=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=do4ObDV2ejUZNdYFsNdgi/NnKJqoE4IGtXO9TAVo89fj4trORtNnUCHJ7jhFRFV7G2gG0upVmbBq86yn2U/BDa75MGX5Nmb8l1g6itDgLySbTzQYEGmQwY1cxrK0PVp004JY6D3t6YrGQNlb/UhQ/00tc8RlIWPjTPOyGRS+xZo= 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=LQAuY8fW; arc=none smtp.client-ip=209.85.167.42 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LQAuY8fW" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-5365928acd0so639172e87.2 for ; Thu, 19 Sep 2024 01:50:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726735837; x=1727340637; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=5aXfImNByrHCJYvhykUtqf/Cf9grdz1yZdroYSEnzd0=; b=LQAuY8fW4NCyS1obfBddcWXm5q8x9UBkqWcTcNuq39VQ8DvPzDRgXGepireJAxFcZb v1HbwpN7ruzLIsRW09u3lo2knxxJ7PRZ5kMdC/FH/GOJMv3MGnBYY+eQ7jf1TpXbBqcJ T9AS8XOPIQnk2LVF37fDiEjldh+c/oBO27fvXVynZPIYx8CWceuIFQfHQTuWMyaNTPUB UlFQ7y8Z/WD/qtJYvQSV7VeBKUn84c7W6aKdp6hDLi6ig3u+yrMYkq262AfSVj3mrVqn NuIiAC5zxUHg3WRXc6nY4kc3gago+0/XPPNZKBWcsnGYFTbHCm0Wlf+eqVN6QSRAnOWW oLEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726735837; x=1727340637; h=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=5aXfImNByrHCJYvhykUtqf/Cf9grdz1yZdroYSEnzd0=; b=SK5ZA/Zb92cFzfoTjK+dZZEh85AwKH2Mo9klQXSmepvSatvKrzKpep+SxO6HRiEqtQ 8HECSQ3QpNRtTEcU14/UYerV/ikBog4frCWsoWaffWpgoEdp/f65OeC2ApAP+gmI9iSk INQ+YkwVyjtxWfLGuDAICEEmaUVmzTSU3AVcKUXhxBVHZsMIgHTCeYAUOSqf2lreDeAC fRTLy4cSJ3DuCKjbBlFNtgpRfSJiFAdXO6zvdJiOzbrqTleObThXhNUWM/rbnTNGHXCv 0T2nSp4mvBq1yVwBvh9U+a9qn8vq+hreB+3XrKYViVCkKmX+ia2MtfCmmT81h86jAEeU xYTA== X-Forwarded-Encrypted: i=1; AJvYcCXAHrPHMbGcVgvKIvf+Hvy3ufSwjVvUWjCYLjKAg/S9XkDV4Oaqw1WRzdZoJ6rkBV00aL7x5EEBg3AFStQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxDfVOzetxZN6QcZgR4uF/2m8Beri+pksNXog3494Bi7MpzFCdo yJbRZhxSPV+ve+8AUD/FMMaHyAeaJ+6cKI/P1tZ/UwD8jrHTXFPNtpSbaPcZeHc= X-Google-Smtp-Source: AGHT+IHSchKP46mdULrhq3wm2RZ+wk7t1utwjuIcumCt9aQiICck+yHRyOAOwRnLE0p5ES06sz5eOQ== X-Received: by 2002:a05:6512:1194:b0:530:dab8:7dd6 with SMTP id 2adb3069b0e04-53678ff48d5mr12195614e87.50.1726735837431; Thu, 19 Sep 2024 01:50:37 -0700 (PDT) Received: from localhost ([83.68.141.146]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c42bb533besm5833278a12.26.2024.09.19.01.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2024 01:50:36 -0700 (PDT) Date: Thu, 19 Sep 2024 11:50:33 +0300 From: Dan Carpenter To: Trond Myklebust Cc: Anna Schumaker , Benny Halevy , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] SUNRPC: Fix integer overflow in decode_rc_list() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The math in "rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)" could have an integer overflow. Add bounds checking on rc_list->rcl_nrefcalls to fix that. Fixes: 4aece6a19cf7 ("nfs41: cb_sequence xdr implementation") Signed-off-by: Dan Carpenter --- From static analysis. fs/nfs/callback_xdr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 6df77f008d3f..fdeb0b34a3d3 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -375,6 +375,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr, =20 rc_list->rcl_nrefcalls =3D ntohl(*p++); if (rc_list->rcl_nrefcalls) { + if (unlikely(rc_list->rcl_nrefcalls > xdr->buf->len)) + goto out; p =3D xdr_inline_decode(xdr, rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)); if (unlikely(p =3D=3D NULL)) --=20 2.34.1