Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.infradead.org/users/eparis/notify

* 'for-linus' of git://git.infradead.org/users/eparis/notify:
inotify: don't leak user struct on inotify release
inotify: race use after free/double free in inotify inode marks
inotify: clean up the inotify_add_watch out path
Inotify: undefined reference to `anon_inode_getfd'

Manual merge to remove duplicate "select ANON_INODES" from Kconfig file

+10 -8
+2
fs/notify/inotify/inotify_fsnotify.c
··· 28 28 #include <linux/path.h> /* struct path */ 29 29 #include <linux/slab.h> /* kmem_* */ 30 30 #include <linux/types.h> 31 + #include <linux/sched.h> 31 32 32 33 #include "inotify.h" 33 34 ··· 147 146 idr_for_each(&group->inotify_data.idr, idr_callback, group); 148 147 idr_remove_all(&group->inotify_data.idr); 149 148 idr_destroy(&group->inotify_data.idr); 149 + free_uid(group->inotify_data.user); 150 150 } 151 151 152 152 void inotify_free_event_priv(struct fsnotify_event_private_data *fsn_event_priv)
+8 -8
fs/notify/inotify/inotify_user.c
··· 546 546 if (unlikely(!idr_pre_get(&group->inotify_data.idr, GFP_KERNEL))) 547 547 goto out_err; 548 548 549 + /* we are putting the mark on the idr, take a reference */ 550 + fsnotify_get_mark(&tmp_ientry->fsn_entry); 551 + 549 552 spin_lock(&group->inotify_data.idr_lock); 550 553 ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry, 551 554 group->inotify_data.last_wd+1, 552 555 &tmp_ientry->wd); 553 556 spin_unlock(&group->inotify_data.idr_lock); 554 557 if (ret) { 558 + /* we didn't get on the idr, drop the idr reference */ 559 + fsnotify_put_mark(&tmp_ientry->fsn_entry); 560 + 555 561 /* idr was out of memory allocate and try again */ 556 562 if (ret == -EAGAIN) 557 563 goto retry; 558 564 goto out_err; 559 565 } 560 - 561 - /* we put the mark on the idr, take a reference */ 562 - fsnotify_get_mark(&tmp_ientry->fsn_entry); 563 566 564 567 /* we are on the idr, now get on the inode */ 565 568 ret = fsnotify_add_mark(&tmp_ientry->fsn_entry, group, inode); ··· 581 578 /* return the watch descriptor for this new entry */ 582 579 ret = tmp_ientry->wd; 583 580 584 - /* match the ref from fsnotify_init_markentry() */ 585 - fsnotify_put_mark(&tmp_ientry->fsn_entry); 586 - 587 581 /* if this mark added a new event update the group mask */ 588 582 if (mask & ~group->mask) 589 583 fsnotify_recalc_group_mask(group); 590 584 591 585 out_err: 592 - if (ret < 0) 593 - kmem_cache_free(inotify_inode_mark_cachep, tmp_ientry); 586 + /* match the ref from fsnotify_init_markentry() */ 587 + fsnotify_put_mark(&tmp_ientry->fsn_entry); 594 588 595 589 return ret; 596 590 }