Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2615524pxb; Mon, 19 Apr 2021 09:37:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPARzOu2IQxA3l2vAR1iYkt7zGB6utV9ywOb21eyZklr0qIm1UMwvk2eHbI0OCsZ5wKOxd X-Received: by 2002:a50:9b4e:: with SMTP id a14mr26636352edj.0.1618850269236; Mon, 19 Apr 2021 09:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618850269; cv=none; d=google.com; s=arc-20160816; b=Cv2h2knrnDcCbaJ1IKS084lXej6tUQBACmpdayVhyqROZNsb3YBZELvYUHMOUYDxl6 qZ4KlkO/5J/Dy+J30xcIh7PcHEvdXpnIK2Zv+wbjrxvBQ/nNY86U//9/+bjG6KHEP77X HJU0br68GRIUBvfra4lfMv2gAL47OfJ9CnDI6bth4zqWIwLih07vfgo+WEofAm3I5jmr +JYxB3xDruWJvXt1Hb9tjLfazyjuO9DTajnr/g2UHHj//spYuz+ZBghtGzzVoc/C9tzG JGjsWi/T3BE57B8lcjeJTaMZ6rouh27UE0lseyaBj3BuetQM1dg8AYP0Qj1559k7IZgi dtJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RKVgXAX0mREX8Z0MCpmywkdwIZCixUAvYUJ20KmIUmM=; b=eZepj/SZorK3ecY/uFI5ANsmoBgSUXz5SE2CSUQCmgUf/cLXUNM9yJJIboEjBPH9tc BzVwe73+oUHceVr06ARRVP9AQID4PbVRw8iL2uOnIiWqYFjDc5/m2i19cPruuZPvIrA0 EoKagbL/C3KiqLzCJfgN+w8RA/k0CXMt5GHZcB0RkV52Mwo5dkYj5LxZhgMJqxcLt14M MgufSBbycu+ADWYwS1EcvOR8bZTYp75CCY1gLdpKy4jfEiqk9NmgMnmpBOC/GUdQP/VW azZgKQSnPHJ3vfGRexu1Cb8r0PTdQqtjoTdaQWf65udLiyHTOKjrHH+NcjNLcUlaeeeY q9jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HQe4hHu3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si12821594eda.196.2021.04.19.09.37.18; Mon, 19 Apr 2021 09:37:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HQe4hHu3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231779AbhDSQhi (ORCPT + 99 others); Mon, 19 Apr 2021 12:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbhDSQhh (ORCPT ); Mon, 19 Apr 2021 12:37:37 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA67C06174A; Mon, 19 Apr 2021 09:37:06 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id y3so5235266eds.5; Mon, 19 Apr 2021 09:37:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RKVgXAX0mREX8Z0MCpmywkdwIZCixUAvYUJ20KmIUmM=; b=HQe4hHu3jDM3VMM9bgAAJO7LJ1nuzE2Zlm+7CJbv/ZQT+d3t5c8GKY1wiK0P/d8sER a3YCO30m7N+/NsNvJzeRpjp0sdsPecqrjP0KqkOsxjX2tdc+g14KTOmn5H7oI6l8TWyv dby33R1hSpDmVfW2JNU/Im6NwYKXLANxpwarInv//7qs4r5cSz69DvJ3SF2grgW0RE5r LXSAhroeOwlMllkLcfxytfjHUV38DdEsd6EJo7nb/rnkjgE7MEwm6oZkgX/dtAtnabf5 KaH8SR5JV2vOehwvD8JS9jtDjCMtaciFE+cMZqFSSRbiqoWoQQQkkkCP9cmggTld2IqI oibQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RKVgXAX0mREX8Z0MCpmywkdwIZCixUAvYUJ20KmIUmM=; b=pj8yvU3YrArr/nAQ21nuvClngXEH5CqhMoKvlOKClc60fUnNCPjkybbo59SU2UsuxM Ak2VW6CUVM7kkckuLkvPoD4RTHtEC/461tu6OW53u9WP6hk3c8X7DT5L5yC80LCkoD3P Y/WRyBJFiB4UZRrX6zHkVsYWzGIfb+XPWn8+UIqG/epGpCD3WQfCtYxUYChfyV6BWssw 9erVNKlCC8kC1COdnqX81zZbXG6QR/boKREdUtjtYhXBfGWtD0sxtdnRHpwaTb4vAdrf AhlxNlxXcNGF4k9U+q3ePTiu7meocCgZup60vRPkACM818aZqd2QJk/w2knBXeTQ6Kgl c73Q== X-Gm-Message-State: AOAM533VgjplroIgJGn5rDxaToX9qz9fl7OsE2aKl6L+gAo/JrIsYvxh mBiO+6M2mCsziafoSNwh4tI= X-Received: by 2002:a05:6402:cbb:: with SMTP id cn27mr12958654edb.222.1618850225382; Mon, 19 Apr 2021 09:37:05 -0700 (PDT) Received: from localhost.localdomain ([185.58.55.85]) by smtp.gmail.com with ESMTPSA id c19sm13196792edu.20.2021.04.19.09.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Apr 2021 09:37:04 -0700 (PDT) From: Kurt Manucredo To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, bfields@fieldses.org, chuck.lever@oracle.com, davem@davemloft.net, kuba@kernel.org, skhan@linuxfoundation.org Cc: Kurt Manucredo , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, syzbot+ba2e91df8f74809417fa@syzkaller.appspotmail.com, gregkh@linuxfoundation.org Subject: [PATCH] net: sunrpc: xprt.c: fix shift-out-of-bounds in xprt_calc_majortimeo Date: Mon, 19 Apr 2021 16:36:03 +0000 Message-Id: <20210419163603.7-1-fuzzybritches0@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Fix shift-out-of-bounds in xprt_calc_majortimeo(). UBSAN: shift-out-of-bounds in net/sunrpc/xprt.c:658:14 shift exponent 536871232 is too large for 64-bit type 'long u Reported-by: syzbot+ba2e91df8f74809417fa@syzkaller.appspotmail.com Signed-off-by: Kurt Manucredo --- net/sunrpc/xprt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c index 691ccf8049a4..07128ac3d51d 100644 --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -655,7 +655,10 @@ static unsigned long xprt_calc_majortimeo(struct rpc_rqst *req) unsigned long majortimeo = req->rq_timeout; if (to->to_exponential) - majortimeo <<= to->to_retries; + if (to->to_retries >= sizeof(majortimeo) * 8) + majortimeo = to->to_maxval; + else + majortimeo <<= to->to_retries; else majortimeo += to->to_increment * to->to_retries; if (majortimeo > to->to_maxval || majortimeo == 0) -- 2.30.2