forked from mirrors/linux
		
	 f4ae4081e5
			
		
	
	
		f4ae4081e5
		
	
	
	
	
		
			
			The interface for fcntl expects the argument passed for the command F_DIRNOTIFY to be of type int. The current code wrongly treats it as a long. In order to avoid access to undefined bits, we should explicitly cast the argument to int. Cc: Jan Kara <jack@suse.cz> Cc: Amir Goldstein <amir73il@gmail.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Christian Brauner <brauner@kernel.org> Cc: Jeff Layton <jlayton@kernel.org> Cc: Chuck Lever <chuck.lever@oracle.com> Cc: Kevin Brodsky <Kevin.Brodsky@arm.com> Cc: Vincenzo Frascino <Vincenzo.Frascino@arm.com> Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: David Laight <David.Laight@ACULAB.com> Cc: Mark Rutland <Mark.Rutland@arm.com> Cc: linux-fsdevel@vger.kernel.org Cc: linux-morello@op-lists.linaro.org Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: Luca Vizzarro <Luca.Vizzarro@arm.com> Message-Id: <20230414152459.816046-6-Luca.Vizzarro@arm.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
		
			
				
	
	
		
			50 lines
		
	
	
	
		
			1,012 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
	
		
			1,012 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0 */
 | |
| #ifndef _LINUX_DNOTIFY_H
 | |
| #define _LINUX_DNOTIFY_H
 | |
| /*
 | |
|  * Directory notification for Linux
 | |
|  *
 | |
|  * Copyright (C) 2000,2002 Stephen Rothwell
 | |
|  */
 | |
| 
 | |
| #include <linux/fs.h>
 | |
| 
 | |
| struct dnotify_struct {
 | |
| 	struct dnotify_struct *	dn_next;
 | |
| 	__u32			dn_mask;
 | |
| 	int			dn_fd;
 | |
| 	struct file *		dn_filp;
 | |
| 	fl_owner_t		dn_owner;
 | |
| };
 | |
| 
 | |
| #ifdef __KERNEL__
 | |
| 
 | |
| 
 | |
| #ifdef CONFIG_DNOTIFY
 | |
| 
 | |
| #define DNOTIFY_ALL_EVENTS (FS_DELETE | FS_DELETE_CHILD |\
 | |
| 			    FS_MODIFY | FS_MODIFY_CHILD |\
 | |
| 			    FS_ACCESS | FS_ACCESS_CHILD |\
 | |
| 			    FS_ATTRIB | FS_ATTRIB_CHILD |\
 | |
| 			    FS_CREATE | FS_RENAME |\
 | |
| 			    FS_MOVED_FROM | FS_MOVED_TO)
 | |
| 
 | |
| extern void dnotify_flush(struct file *, fl_owner_t);
 | |
| extern int fcntl_dirnotify(int, struct file *, unsigned int);
 | |
| 
 | |
| #else
 | |
| 
 | |
| static inline void dnotify_flush(struct file *filp, fl_owner_t id)
 | |
| {
 | |
| }
 | |
| 
 | |
| static inline int fcntl_dirnotify(int fd, struct file *filp, unsigned int arg)
 | |
| {
 | |
| 	return -EINVAL;
 | |
| }
 | |
| 
 | |
| #endif /* CONFIG_DNOTIFY */
 | |
| 
 | |
| #endif /* __KERNEL __ */
 | |
| 
 | |
| #endif /* _LINUX_DNOTIFY_H */
 |