Message ID | 20210717000557.60029-1-ebiggers@kernel.org |
---|---|
State | New |
Headers | show |
Series | [4.9] fscrypt: don't ignore minor_hash when hash is 0 | expand |
On Fri, Jul 16, 2021 at 07:05:57PM -0500, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > commit 77f30bfcfcf484da7208affd6a9e63406420bf91 upstream. > [Please apply to 4.9-stable.] Now queued up, thanks! greg k-h
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index e14bb7b67e9c..5136ea195934 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -294,12 +294,8 @@ int fscrypt_fname_disk_to_usr(struct inode *inode, oname->name); return 0; } - if (hash) { - memcpy(buf, &hash, 4); - memcpy(buf + 4, &minor_hash, 4); - } else { - memset(buf, 0, 8); - } + memcpy(buf, &hash, 4); + memcpy(buf + 4, &minor_hash, 4); memcpy(buf + 8, iname->name + ((iname->len - 17) & ~15), 16); oname->name[0] = '_'; oname->len = 1 + digest_encode(buf, 24, oname->name + 1);