mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
fanotify: Allow file handle encoding for unhashed events
Allow passing a NULL hash to fanotify_encode_fh and avoid calculating the hash if not needed. Link: https://lore.kernel.org/r/20211025192746.66445-15-krisman@collabora.com Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
12f47bf0f0
commit
74fe473489
1 changed files with 6 additions and 2 deletions
|
@ -403,8 +403,12 @@ static int fanotify_encode_fh(struct fanotify_fh *fh, struct inode *inode,
|
|||
fh->type = type;
|
||||
fh->len = fh_len;
|
||||
|
||||
/* Mix fh into event merge key */
|
||||
*hash ^= fanotify_hash_fh(fh);
|
||||
/*
|
||||
* Mix fh into event merge key. Hash might be NULL in case of
|
||||
* unhashed FID events (i.e. FAN_FS_ERROR).
|
||||
*/
|
||||
if (hash)
|
||||
*hash ^= fanotify_hash_fh(fh);
|
||||
|
||||
return FANOTIFY_FH_HDR_LEN + fh_len;
|
||||
|
||||
|
|
Loading…
Reference in a new issue