]> git.baikalelectronics.ru Git - kernel.git/commit
afs: Fix getting the afs.fid xattr
authorDavid Howells <dhowells@redhat.com>
Wed, 1 May 2019 14:58:24 +0000 (15:58 +0100)
committerDavid Howells <dhowells@redhat.com>
Tue, 7 May 2019 15:48:44 +0000 (16:48 +0100)
commitf0d9e7fd69390773a7b96bc13c561ff9cf009e4f
tree3e0852bef6a908c794b88e74dbdb4efad7c8b1d9
parent447fb509a0c935b322a8a6ec33d92e61943f8e7c
afs: Fix getting the afs.fid xattr

The AFS3 FID is three 32-bit unsigned numbers and is represented as three
up-to-8-hex-digit numbers separated by colons to the afs.fid xattr.
However, with the advent of support for YFS, the FID is now a 64-bit volume
number, a 96-bit vnode/inode number and a 32-bit uniquifier (as before).
Whilst the sprintf in afs_xattr_get_fid() has been partially updated (it
currently ignores the upper 32 bits of the 96-bit vnode number), the size
of the stack-based buffer has not been increased to match, thereby allowing
stack corruption to occur.

Fix this by increasing the buffer size appropriately and conditionally
including the upper part of the vnode number if it is non-zero.  The latter
requires the lower part to be zero-padded if the upper part is non-zero.

Fixes: 41bbaa1b38d8 ("afs: Increase to 64-bit volume ID and 96-bit vnode ID for YFS")
Signed-off-by: David Howells <dhowells@redhat.com>
fs/afs/xattr.c