From: Jan Kara <jack@suse.cz>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org,
Amir Goldstein <amir73il@gmail.com>,
Paul Moore <paul@paul-moore.com>
Subject: Re: [PATCH 20/33] fsnotify: Detach mark from object list when last reference is dropped
Date: Mon, 3 Apr 2017 17:07:37 +0200 [thread overview]
Message-ID: <20170403150737.GG15168@quack2.suse.cz> (raw)
In-Reply-To: <20170403100406.GC15168@quack2.suse.cz>
On Mon 03-04-17 12:04:06, Jan Kara wrote:
> On Fri 31-03-17 17:42:17, Miklos Szeredi wrote:
> > > @@ -202,7 +190,7 @@ static inline struct list_head *chunk_hash(unsigned long key)
> > > /* hash_lock & entry->lock is held by caller */
> > > static void insert_hash(struct audit_chunk *chunk)
> > > {
> > > - unsigned long key = __chunk_to_key(chunk);
> > > + unsigned long key = chunk_to_key(chunk);
> > > struct list_head *list;
> > >
> > > if (!key)
> > > @@ -263,7 +251,7 @@ static void untag_chunk(struct node *p)
> > >
> > > mutex_lock(&entry->group->mark_mutex);
> > > spin_lock(&entry->lock);
> > > - if (chunk->dead || !entry->connector) {
> > > + if (chunk->dead || !entry->connector || !entry->connector->inode) {
> >
> > So should we be testing FSNOTIFY_MARK_FLAG_ATTACHED instead? Without
> > understanding what audit is trying to do, that would be a lot more
> > logical. Or maybe there is a reason this is correct, it just needs an
> > explanation.
>
> That's an interesting idea. AFAIU checking FSNOTIFY_MARK_FLAG_ATTACHED
> should be good and doing so would somewhat simplify the patches as well.
> I'll try to do that.
OK, I did this and also realized that this actually fixes a possible NULL
pointer dereference bug introduced by my series (entry->connector->inode
can become NULL if 'entry' is already detached but inode is still valid at
the time of the check). So I also added a comment about this.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2017-04-03 15:07 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 16:12 [PATCH 0/33 v6] fsnotify: Avoid SRCU stalls with fanotify permission events Jan Kara
2017-03-28 16:13 ` [PATCH 01/33] fsnotify: Remove unnecessary tests when showing fdinfo Jan Kara
2017-03-28 16:13 ` [PATCH 02/33] inotify: Remove inode pointers from debug messages Jan Kara
2017-03-28 16:13 ` [PATCH 03/33] fanotify: Move recalculation of inode / vfsmount mask under mark_mutex Jan Kara
2017-03-28 16:13 ` [PATCH 04/33] audit: Abstract hash key handling Jan Kara
2017-03-28 16:13 ` [PATCH 05/33] fsnotify: Update comments Jan Kara
2017-03-28 16:13 ` [PATCH 06/33] fsnotify: Move mark list head from object into dedicated structure Jan Kara
2017-03-28 16:13 ` [PATCH 07/33] fsnotify: Move object pointer to fsnotify_mark_connector Jan Kara
2017-03-28 16:13 ` [PATCH 08/33] fsnotify: Make fsnotify_mark_connector hold inode reference Jan Kara
2017-03-28 16:13 ` [PATCH 09/33] fsnotify: Remove indirection from mark list addition Jan Kara
2017-03-28 16:13 ` [PATCH 10/33] fsnotify: Move fsnotify_destroy_marks() Jan Kara
2017-03-28 16:13 ` [PATCH 11/33] fsnotify: Move locking into fsnotify_recalc_mask() Jan Kara
2017-03-28 16:13 ` [PATCH 12/33] fsnotify: Move locking into fsnotify_find_mark() Jan Kara
2017-03-28 16:13 ` [PATCH 13/33] fsnotify: Determine lock in fsnotify_destroy_marks() Jan Kara
2017-03-28 16:13 ` [PATCH 14/33] fsnotify: Remove indirection from fsnotify_detach_mark() Jan Kara
2017-03-29 15:29 ` Miklos Szeredi
2017-03-30 7:21 ` Jan Kara
2017-03-28 16:13 ` [PATCH 15/33] fsnotify: Remove useless list deletion and comment Jan Kara
2017-03-28 16:13 ` [PATCH 16/33] fsnotify: Lock object list with connector lock Jan Kara
2017-03-28 16:13 ` [PATCH 17/33] fsnotify: Free fsnotify_mark_connector when there is no mark attached Jan Kara
2017-03-30 10:02 ` Miklos Szeredi
2017-03-30 14:09 ` Jan Kara
2017-03-28 16:13 ` [PATCH 18/33] inotify: Do not drop mark reference under idr_lock Jan Kara
2017-03-28 16:13 ` [PATCH 19/33] fsnotify: Move queueing of mark for destruction into fsnotify_put_mark() Jan Kara
2017-03-28 16:13 ` [PATCH 20/33] fsnotify: Detach mark from object list when last reference is dropped Jan Kara
2017-03-31 15:42 ` Miklos Szeredi
2017-04-03 10:04 ` Jan Kara
2017-04-03 15:07 ` Jan Kara [this message]
2017-03-28 16:13 ` [PATCH 21/33] fsnotify: Remove special handling of mark destruction on group shutdown Jan Kara
2017-03-28 16:13 ` [PATCH 22/33] fsnotify: Provide framework for dropping SRCU lock in ->handle_event Jan Kara
2017-03-28 16:13 ` [PATCH 23/33] fsnotify: Pass fsnotify_iter_info into handle_event handler Jan Kara
2017-03-28 16:13 ` [PATCH 24/33] fanotify: Release SRCU lock when waiting for userspace response Jan Kara
2017-03-28 16:13 ` [PATCH 25/33] fsnotify: Remove fsnotify_set_mark_{,ignored_}mask_locked() Jan Kara
2017-03-28 16:13 ` [PATCH 26/33] fsnotify: Remove fsnotify_recalc_{inode|vfsmount}_mask() Jan Kara
2017-03-28 16:13 ` [PATCH 27/33] fsnotify: Inline fsnotify_clear_{inode|vfsmount}_mark_group() Jan Kara
2017-03-28 16:13 ` [PATCH 28/33] fsnotify: Rename fsnotify_clear_marks_by_group_flags() Jan Kara
2017-03-28 16:13 ` [PATCH 29/33] fsnotify: Remove fsnotify_detach_group_marks() Jan Kara
2017-03-28 16:13 ` [PATCH 30/33] fsnotify: Remove fsnotify_find_{inode|vfsmount}_mark() Jan Kara
2017-03-28 16:13 ` [PATCH 31/33] fsnotify: Drop inode_mark.c Jan Kara
2017-03-28 16:13 ` [PATCH 32/33] fsnotify: Add group pointer in fsnotify_init_mark() Jan Kara
2017-03-28 16:13 ` [PATCH 33/33] fsnotify: Move ->free_mark callback to fsnotify_ops Jan Kara
2017-04-03 13:19 ` [PATCH 0/33 v6] fsnotify: Avoid SRCU stalls with fanotify permission events Miklos Szeredi
2017-04-03 15:23 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2017-03-15 10:45 [PATCH 0/33 v5] " Jan Kara
2017-03-15 10:46 ` [PATCH 20/33] fsnotify: Detach mark from object list when last reference is dropped Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170403150737.GG15168@quack2.suse.cz \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=paul@paul-moore.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.