Re: [PATCH 30/33] block, aio: batch completion for bios/kiocbs

From: Theodore Ts'o
Date: Tue Apr 02 2013 - 15:53:22 EST


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....

> +
> + 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/