[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130719052312.GC3087@amit-x200.redhat.com>
Date: Fri, 19 Jul 2013 10:53:12 +0530
From: Amit Shah <amit.shah@...hat.com>
To: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@...achi.com>
Cc: linux-kernel@...r.kernel.org,
Hidehiro Kawai <hidehiro.kawai.ez@...achi.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
Arnd Bergmann <arnd@...db.de>, yrl.pp-manager.tt@...achi.com
Subject: Re: [PATCH 2/2] [BUGFIX] virtio/console: Add pipe_lock/unlock for
splice_write
On (Fri) 19 Jul 2013 [08:19:32], Yoshihiro YUNOMAE wrote:
> Add pipe_lock/unlock for splice_write to avoid oops by following competition:
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index 8722656..4a28e4c 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -936,6 +936,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
> * pipe->nrbufs == 0 means there are no data to transfer,
> * so this returns just 0 for no data.
> */
> + pipe_lock(pipe);
> if (!pipe->nrbufs)
> return 0;
>
> @@ -953,6 +954,7 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
> sgl.sg = buf->sg;
> sg_init_table(sgl.sg, sgl.size);
> ret = __splice_from_pipe(pipe, &sd, pipe_to_sg);
> + pipe_unlock(pipe);
> if (likely(ret > 0))
> ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true);
>
>
You're not unlocking in all the error return cases.
Amit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists