From patchwork Mon Nov 11 20:16:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 179134 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7143208ilf; Mon, 11 Nov 2019 12:17:41 -0800 (PST) X-Google-Smtp-Source: APXvYqw2HXOnR5daZfI84sG/ke9F936jfYOAGQrgNAQMX3Sl1xiBcVdIW2PpUIuyXlDhwJYNS9wB X-Received: by 2002:a05:6402:104c:: with SMTP id e12mr22044866edu.199.1573503461623; Mon, 11 Nov 2019 12:17:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573503461; cv=none; d=google.com; s=arc-20160816; b=PEToAT4djcc4Y0WIpRQL6+URFBOOVGH117MEUYxcwzCivclI0/tQ6EzlIo0xL/pfTs MmO9BMou8or+zjvUrNRDOAhi1gZ5dZpWKX8/enu3gxjFEpOTVeUHicTPI4ShZd/07wf0 osDe0hNZFxNkAByf1PeVxrzFZ7PfZ2zh+I54hQHThXjQSXtoPyNAHxd2KVH7GDWIHl8z 9G/tZ9vgGLfxtK8AAL34mHOBSGy/vSeuzPx+EICn+PmBcAeqJtJlNccUiGgGk9MDxk8m 8e6pYIiFZxOzBkSipPGIo+RIDlAxKjUkDx+Cgbpu6/GVsPaDaam1sj4GArcm3XCFD/dq hOKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=y5u09Q2uGLzFAPd29bVuz8BA6CP1XYaqAfo4C0KZH9c=; b=WwBS9qGIUoRwtKD0Qi7hg9i0ahaLsLqI4cGepoEX/Nbf2KpuG0Jh4wr1ld9MTs04Qr cEqnTE2VwR7ZdbaqbYGWJDkW+3wuB067DdP68tmqO5UpocUiL6JtE59D9IGStCGcmDyv HhOuNpEEFaoCH953is7FU5MxDx0cudZlEqJ5xL4HKtT0UpJ8JwAyXhW5TLx935EU0D7e H/+8gv0PcPJxfpPigjc0X2ZZMENLufEQGFA2FBC4w3DkYGLjRx/t257/TqR7zYGVx776 KNGOQNv299HdeRopDZZb1Uilo2B1e5Q30GuMWy+YHOTTR9MJODob/7XF3FuEfwe1K1Ls eivA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si12912279edp.302.2019.11.11.12.17.41; Mon, 11 Nov 2019 12:17:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbfKKURD (ORCPT + 26 others); Mon, 11 Nov 2019 15:17:03 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:33919 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbfKKURC (ORCPT ); Mon, 11 Nov 2019 15:17:02 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.145]) with ESMTPA (Nemesis) id 1N6svJ-1hphAy14rX-018NFQ; Mon, 11 Nov 2019 21:16:51 +0100 From: Arnd Bergmann To: linux-nfs@vger.kernel.org, "J. Bruce Fields" , Chuck Lever , Trond Myklebust , Anna Schumaker Cc: y2038@lists.linaro.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 15/19] nfsd: fix delay timer on 32-bit architectures Date: Mon, 11 Nov 2019 21:16:35 +0100 Message-Id: <20191111201639.2240623-16-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191111201639.2240623-1-arnd@arndb.de> References: <20191111201639.2240623-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:gmiJexBFvqElF3mq4b9b+BZDQ8d72Q7kCeZTPOCjS6AhS6bzlDu NXJLMSB2hdsvgNmtvpikLv8CkbAUuuLITgyvau37mTIqgnGMh2E9z2Kqjdm+HVfcFTkEsgE 9/kcOOnOXlfAtr/6WB+MFLMVjWxlTuUuJmcpK3g5R/UWsE22dELI9rGE5eFOqYyEefJsgrh 5uj7yStbDDRkV90oaUamg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:OuSNcZeVEos=:x5ZXKdsBl17wIelyNU21r3 8HywO3EQnZh63jP5CdexIy9kbzHofX+dQ9vWCbGyNW6gxNBDmMoQdYNIOkN7oiQqhOxKT5miN LMLI3zCfLbaVnWqKzXHzkh4SXd60raLsDj6FZ9cqxRnLegxn+ujtQhmJ8O1qrAJ9uGHdZLEyo YYrIHvXt9yrS3dOKUH6D9er6OY6AE3pYEn6niAs26nWvtg31Oh8kIrebSr00Jfwq4uyVMUtMa LovWvlMjgjNNVvy2GM4CZgAc8qjB3IpKNM3Dk2tAM5WyUQRDj1rXtPNk0llxXBskdSmHWOGmM O01Z0XOSo8gBiTaL6JKDtCZPN7/mOK/La4BlGKGPel9nlWIqQdYIRC1lAQSz5LxrOdJNHNCQo c4Yeb6MDh1XYxzXp7hEifvWn65XWZ7EmeYVA8nlUZXm4F9K9Pl6WhGZjrqe15yqHsbxDtEyso zFCbNi+U+ezxW5uyTCO1WGPAhb5r84NSFv0BtGGH2jHcyiYKlhpDoxFXmco9e4u1oP9gxaqpV Coh9Kb8379K2/S45ksuq0DhJCSXfK2+/mVQS5ONJ/KKkCZeqe0VdQvVBVyEdyVL2cQZ6s2Eg4 2SWHkhksSI61c9TmpFxbCv5LIguBAC0j6yaj8sesQwBzjdB8Mqo51GEzubeCjZR2t4nnupwMF oATxST3QYVtUyEn+jyRsq1kCOMrKwM/LWp90kFyffh6rm3nE6VkM+HxbBRHOnuszqT5w59STU lpDJzUcRO0AazmApNe0Emg7YfFD1DDH1qopZZnpp6IhPj6fwpCXEvyn0ltAA5wp4hbWOfP4sh qgUW/h5GeiZ266/UeL//8fY8p9NQIQ9M6LE7YJzHNOR12p1iBWrbBBawW5Lv3hC4nCTp2Nh2e 47wyLsKwTNhlghaiTKhQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The nfsd4_cb_layout_done() function takes a 'time_t' value, multiplied by NSEC_PER_SEC*2 to get a nanosecond value. This works fine on 64-bit architectures, but on 32-bit, any value over 1 second results in a signed integer overflow with unexpected results. Cast one input to a 64-bit type in order to produce the same result that we have on 64-bit architectures, regarless of the type of nfsd4_lease. Fixes: 6b9b21073d3b ("nfsd: give up on CB_LAYOUTRECALLs after two lease periods") Signed-off-by: Arnd Bergmann --- fs/nfsd/nfs4layouts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 2681c70283ce..e12409eca7cc 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c @@ -675,7 +675,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task) /* Client gets 2 lease periods to return it */ cutoff = ktime_add_ns(task->tk_start, - nn->nfsd4_lease * NSEC_PER_SEC * 2); + (u64)nn->nfsd4_lease * NSEC_PER_SEC * 2); if (ktime_before(now, cutoff)) { rpc_delay(task, HZ/100); /* 10 mili-seconds */