mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
\n
-----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEq1nRK9aeMoq1VSgcnJ2qBz9kQNkFAmRcFLAACgkQnJ2qBz9k QNmSuQf+P+hFOHVpCb83S4TrNsfPC9M7Pv/M1Rw926p1gESNLez1ElAx2B35OIBZ y4ijqrSHgXbCsC3PvbxR9YfBPJZwIhtmKwjPC+9KlhAFB536Bvt/nt34fjRCWJiS nABnexegkirk7EQufAGVZQ1gtm1p0qSCA1B/l5AFl4KeLIin31U/08F2eE1OAo3K TmxhXzlC+JRXjf/X/X8mzJ8nz/hY5039BDvs7EpVdOsZcLFRQcCUygUCrOdV94uI 1wyzMoGNaiIsZHpHPf3NtphUoE9IFpZQJGXMTR4ehBgFYkkOHYxsjW+wn8YOmaks qzRRXb9w0WdgAXChDGu1xYXV6Wpjiw== =kqSe -----END PGP SIGNATURE----- Merge tag 'fsnotify_for_v6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs Pull inotify fix from Jan Kara: "A fix for possibly reporting invalid watch descriptor with inotify event" * tag 'fsnotify_for_v6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: inotify: Avoid reporting event with invalid wd
This commit is contained in:
commit
d295b66a7b
1 changed files with 9 additions and 2 deletions
|
@ -65,7 +65,7 @@ int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, u32 mask,
|
||||||
struct fsnotify_event *fsn_event;
|
struct fsnotify_event *fsn_event;
|
||||||
struct fsnotify_group *group = inode_mark->group;
|
struct fsnotify_group *group = inode_mark->group;
|
||||||
int ret;
|
int ret;
|
||||||
int len = 0;
|
int len = 0, wd;
|
||||||
int alloc_len = sizeof(struct inotify_event_info);
|
int alloc_len = sizeof(struct inotify_event_info);
|
||||||
struct mem_cgroup *old_memcg;
|
struct mem_cgroup *old_memcg;
|
||||||
|
|
||||||
|
@ -80,6 +80,13 @@ int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, u32 mask,
|
||||||
i_mark = container_of(inode_mark, struct inotify_inode_mark,
|
i_mark = container_of(inode_mark, struct inotify_inode_mark,
|
||||||
fsn_mark);
|
fsn_mark);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We can be racing with mark being detached. Don't report event with
|
||||||
|
* invalid wd.
|
||||||
|
*/
|
||||||
|
wd = READ_ONCE(i_mark->wd);
|
||||||
|
if (wd == -1)
|
||||||
|
return 0;
|
||||||
/*
|
/*
|
||||||
* Whoever is interested in the event, pays for the allocation. Do not
|
* Whoever is interested in the event, pays for the allocation. Do not
|
||||||
* trigger OOM killer in the target monitoring memcg as it may have
|
* trigger OOM killer in the target monitoring memcg as it may have
|
||||||
|
@ -110,7 +117,7 @@ int inotify_handle_inode_event(struct fsnotify_mark *inode_mark, u32 mask,
|
||||||
fsn_event = &event->fse;
|
fsn_event = &event->fse;
|
||||||
fsnotify_init_event(fsn_event);
|
fsnotify_init_event(fsn_event);
|
||||||
event->mask = mask;
|
event->mask = mask;
|
||||||
event->wd = i_mark->wd;
|
event->wd = wd;
|
||||||
event->sync_cookie = cookie;
|
event->sync_cookie = cookie;
|
||||||
event->name_len = len;
|
event->name_len = len;
|
||||||
if (len)
|
if (len)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue