BACKPORT: Smack: fix behavior of smack_inode_listsecurity
authorKonstantin Khlebnikov <k.khlebnikov@samsung.com>
Thu, 7 Aug 2014 16:52:33 +0000 (20:52 +0400)
committerRafal Krypa <r.krypa@samsung.com>
Thu, 30 Jun 2016 12:57:38 +0000 (14:57 +0200)
commitc6ea93cf7a7143e1ca9b102441a25b2db23de641
tree3cca7752d6952b613590f79a5aa94be4cc845201
parent7500b3e4b66a96deb0db92efc7cd94ca113c04de
BACKPORT: Smack: fix behavior of smack_inode_listsecurity

Security operation ->inode_listsecurity is used for generating list of
available extended attributes for syscall listxattr. Currently it's used
only in nfs4 or if filesystem doesn't provide i_op->listxattr.

The list is the set of NULL-terminated names, one after the other.
This method must include zero byte at the and into result.

Also this function must return length even if string does not fit into
output buffer or it is NULL, see similar method in selinux and man listxattr.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
(cherry-picked from upstream fd5c9d230d2ac8a2594dfd15f0cca678fd7a64c7)
security/smack/smack_lsm.c