]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nfsd: use ktime_get_real_seconds() in nfs4_verifier
authorArnd Bergmann <arnd@arndb.de>
Mon, 4 Nov 2019 15:45:30 +0000 (16:45 +0100)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 20 Dec 2019 03:07:17 +0000 (22:07 -0500)
gen_confirm() generates a unique identifier based on the current
time. This overflows in year 2038, but that is harmless since it
generally does not lead to duplicates, as long as the time has
been initialized by a real-time clock or NTP.

Using ktime_get_boottime_seconds() or ktime_get_seconds() would
avoid the overflow, but it would be more likely to result in
non-unique numbers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c

index 1ad68b49a1017bb9915d1ae8a0d82eacb53ed089..65cfe9ab47be0e25c552511f51552218c15d3012 100644 (file)
@@ -2264,7 +2264,7 @@ static void gen_confirm(struct nfs4_client *clp, struct nfsd_net *nn)
         * This is opaque to client, so no need to byte-swap. Use
         * __force to keep sparse happy
         */
-       verf[0] = (__force __be32)get_seconds();
+       verf[0] = (__force __be32)(u32)ktime_get_real_seconds();
        verf[1] = (__force __be32)nn->clverifier_counter++;
        memcpy(clp->cl_confirm.data, verf, sizeof(clp->cl_confirm.data));
 }