mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 15:32:04 +02:00
\n
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEq1nRK9aeMoq1VSgcnJ2qBz9kQNkFAmrWCYEACgkQnJ2qBz9k QNlEugf/cDtCZNRFtq8Ex9tU+Dfqy6A1HWcqntFtcFLNeze+H4YihiKdkwT4xhWG 7RMl5lXnjhXEXzxoj2LmTupKMo2OpW1waHa+01I/mA2Rfy7wF6b/VDOHzVF8avQP sGB4F5kQn9cWCNZA7gJpNu5uA8jVjuiApm9dbTU0CCXwDOPhe16HvnPCfH0JEI63 qWAq+NIY1m/tyYj3WPa+ZucdveR1FFKh9wfWAOccmP5lwGVhz4OPCLRjRPDgMdfT S9EIXlc+O7SLb5++oDghRAmZ/F5lQm+Y0HJsMMA70shau66zGTvZnqzfWJYeOWKd R3oUk51OSYZxD/xHI6VWlYMQ5pkFpQ== =WA/p -----END PGP SIGNATURE----- Merge tag 'fsnotify_for_v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs Pull fsnotify updates from Jan Kara: "A couple of smaller changes for fsnotify" * tag 'fsnotify_for_v7.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: fanotify: report names longer than NAME_MAX fanotify: Re-add Matt Bobrowski as a reviewer fsnotify: fix typo "anonynous" in comment
This commit is contained in:
commit
fefd797c41
|
|
@ -10010,6 +10010,7 @@ F: net/core/failover.c
|
|||
FANOTIFY
|
||||
M: Jan Kara <jack@suse.cz>
|
||||
R: Amir Goldstein <amir73il@gmail.com>
|
||||
R: Matt Bobrowski <matt@bobrowski.net>
|
||||
L: linux-fsdevel@vger.kernel.org
|
||||
S: Maintained
|
||||
F: fs/notify/fanotify/
|
||||
|
|
|
|||
|
|
@ -648,6 +648,9 @@ static struct fanotify_event *fanotify_alloc_name_event(struct inode *dir,
|
|||
unsigned long name2_len = name2 ? name2->len : 0;
|
||||
unsigned int len, size;
|
||||
|
||||
if (WARN_ON_ONCE(name_len >= PATH_MAX || name2_len >= PATH_MAX))
|
||||
return NULL;
|
||||
|
||||
/* Reserve terminating null byte even for empty name */
|
||||
size = sizeof(*fne) + name_len + name2_len + 2;
|
||||
if (dir_fh_len)
|
||||
|
|
@ -656,7 +659,7 @@ static struct fanotify_event *fanotify_alloc_name_event(struct inode *dir,
|
|||
size += FANOTIFY_FH_HDR_LEN + dir2_fh_len;
|
||||
if (child_fh_len)
|
||||
size += FANOTIFY_FH_HDR_LEN + child_fh_len;
|
||||
fne = kmalloc(size, gfp);
|
||||
fne = kvmalloc(size, gfp);
|
||||
if (!fne)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -1050,7 +1053,7 @@ static void fanotify_free_fid_event(struct fanotify_event *event)
|
|||
|
||||
static void fanotify_free_name_event(struct fanotify_event *event)
|
||||
{
|
||||
kfree(FANOTIFY_NE(event));
|
||||
kvfree(FANOTIFY_NE(event));
|
||||
}
|
||||
|
||||
static void fanotify_free_error_event(struct fsnotify_group *group,
|
||||
|
|
|
|||
|
|
@ -43,9 +43,16 @@ struct fanotify_info {
|
|||
u8 dir_fh_totlen;
|
||||
u8 dir2_fh_totlen;
|
||||
u8 file_fh_totlen;
|
||||
u8 name_len;
|
||||
u8 name2_len;
|
||||
u8 pad[3];
|
||||
u8 pad;
|
||||
/*
|
||||
* Deliberately not limited to NAME_MAX: some filesystems return longer
|
||||
* names (vfat up to 255 UTF-16 characters, as Windows allows, which is
|
||||
* up to 765 bytes of UTF-8; FUSE up to PATH_MAX - 1), and readdir() and
|
||||
* inotify report them in full. Only names of PATH_MAX bytes or more,
|
||||
* which no path can refer to, are dropped.
|
||||
*/
|
||||
u16 name_len;
|
||||
u16 name2_len;
|
||||
unsigned char buf[];
|
||||
/*
|
||||
* (struct fanotify_fh) dir_fh starts at buf[0]
|
||||
|
|
@ -168,7 +175,7 @@ static inline char *fanotify_info_name2(struct fanotify_info *info)
|
|||
static inline void fanotify_info_init(struct fanotify_info *info)
|
||||
{
|
||||
BUILD_BUG_ON(FANOTIFY_FH_HDR_LEN + MAX_HANDLE_SZ > U8_MAX);
|
||||
BUILD_BUG_ON(NAME_MAX > U8_MAX);
|
||||
BUILD_BUG_ON(PATH_MAX > U16_MAX);
|
||||
|
||||
info->dir_fh_totlen = 0;
|
||||
info->dir2_fh_totlen = 0;
|
||||
|
|
@ -214,8 +221,7 @@ static inline void fanotify_info_set_file_fh(struct fanotify_info *info,
|
|||
static inline void fanotify_info_copy_name(struct fanotify_info *info,
|
||||
const struct qstr *name)
|
||||
{
|
||||
if (WARN_ON_ONCE(name->len > NAME_MAX) ||
|
||||
WARN_ON_ONCE(info->name2_len > 0))
|
||||
if (WARN_ON_ONCE(info->name2_len > 0))
|
||||
return;
|
||||
|
||||
info->name_len = name->len;
|
||||
|
|
@ -225,9 +231,6 @@ static inline void fanotify_info_copy_name(struct fanotify_info *info,
|
|||
static inline void fanotify_info_copy_name2(struct fanotify_info *info,
|
||||
const struct qstr *name)
|
||||
{
|
||||
if (WARN_ON_ONCE(name->len > NAME_MAX))
|
||||
return;
|
||||
|
||||
info->name2_len = name->len;
|
||||
strscpy(fanotify_info_name2(info), name->name, name->len + 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1837,7 +1837,7 @@ static int fanotify_events_supported(struct fsnotify_group *group,
|
|||
/*
|
||||
* mount and sb marks are not allowed on kernel internal pseudo fs,
|
||||
* like pipe_mnt, because that would subscribe to events on all the
|
||||
* anonynous pipes in the system.
|
||||
* anonymous pipes in the system.
|
||||
*
|
||||
* SB_NOUSER covers all of the internal pseudo fs whose objects are not
|
||||
* exposed to user's mount namespace, but there are other SB_KERNMOUNT
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user