From nobody Mon Sep 29 20:18:28 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FCD9C00140 for ; Mon, 15 Aug 2022 22:22:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347768AbiHOWWh (ORCPT ); Mon, 15 Aug 2022 18:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350533AbiHOWR6 (ORCPT ); Mon, 15 Aug 2022 18:17:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6605D1232D6; Mon, 15 Aug 2022 12:41:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 51E9CB80EAB; Mon, 15 Aug 2022 19:41:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACE9EC433D6; Mon, 15 Aug 2022 19:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592461; bh=NNc+ZgAIT93P7mkNlp5ZcQKWVmmubeiDsVrAA3uW0tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqBFGDj83NFXm4Wl1/slM5gE1c0T6j5CpWhNgAz47+c2DwcVS4lKV5F5Hv8FSMyKq RMjdVDW2kkGAFRNGGjnN1LpCbQYuL51w5UgtX+vNmJlryL4Jkts6qpPEf5Qoof13fW Tg88RWq3zxxqSP1gMVk93YUxEvE80CQ9PZknea8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 5.19 0113/1157] fuse: limit nsec Date: Mon, 15 Aug 2022 19:51:09 +0200 Message-Id: <20220815180444.150408212@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi commit 47912eaa061a6a81e4aa790591a1874c650733c0 upstream. Limit nanoseconds to 0..999999999. Fixes: d8a5ba45457e ("[PATCH] FUSE - core") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -180,6 +180,12 @@ void fuse_change_attributes_common(struc inode->i_uid =3D make_kuid(fc->user_ns, attr->uid); inode->i_gid =3D make_kgid(fc->user_ns, attr->gid); inode->i_blocks =3D attr->blocks; + + /* Sanitize nsecs */ + attr->atimensec =3D min_t(u32, attr->atimensec, NSEC_PER_SEC - 1); + attr->mtimensec =3D min_t(u32, attr->mtimensec, NSEC_PER_SEC - 1); + attr->ctimensec =3D min_t(u32, attr->ctimensec, NSEC_PER_SEC - 1); + inode->i_atime.tv_sec =3D attr->atime; inode->i_atime.tv_nsec =3D attr->atimensec; /* mtime from server may be stale due to local buffered write */