On Tue, Apr 02, 2013 at 03:53:03PM -0400, Theodore Ts'o wrote:
> On Thu, Mar 21, 2013 at 09:35:51AM -0700, Kent Overstreet wrote:
> > +           if (unlikely(req->ki_eventfd != eventfd)) {
> > +                   if (eventfd) {
> > +                           /* Make event visible */
> > +                           kioctx_ring_unlock(ctx, tail);
> > +                           ctx = NULL;
> > +
> > +                           eventfd_signal(eventfd, 1);
> > +                           eventfd_ctx_put(eventfd);
> > +                   }
> 
> I just noticed something else.  There's a ring unlock here().... but
> there isn't a matching ring_lock(), or an exit from the function.
> Since you've set the ctx to be NULL, then subsequently, aren't we
> going to crash at the subseqent kioctx_ring_unlock() below....

No, kioctx_ring_unlock() checks for ctx == NULL - it would be more
readable I suppose to have the check outside of kioctx_ring_unlock() but
that's how it ended up... the check is needed multiple places.

> 
> > +
> > +                   eventfd = req->ki_eventfd;
> > +                   req->ki_eventfd = NULL;
> > +           }
> > +
> > +           if (unlikely(req->ki_ctx != ctx)) {
> > +                   kioctx_ring_unlock(ctx, tail);
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> (Or the kioctx_ring_unlock() at the end of this function after the
> while loop terminates.)
> 
>                                               - Ted
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to