All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Arnd Bergmann <arnd@arndb.de>,
	yrl.pp-manager.tt@hitachi.com
Subject: Re: Re: [PATCH 2/2] [BUGFIX] virtio/console: Add pipe_lock/unlock for splice_write
Date: Fri, 19 Jul 2013 14:46:43 +0900	[thread overview]
Message-ID: <51E8D2C3.80600@hitachi.com> (raw)
In-Reply-To: <20130719052312.GC3087@amit-x200.redhat.com>

Hi Amit,

(2013/07/19 14:23), Amit Shah wrote:
> 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.

Oh, sorry.
I'll resend a revised patch soon.
Thanks!

Yoshihiro YUNOMAE

-- 
###2013.03.18より変更###
-------------------------------------------------
湯前 慶大(YUNOMAE Yoshihiro)
(株)日立製作所 横浜研究所
ソフトウェアプラットフォーム研究部 PP3u & LTC
e-mail: yoshihiro.yunomae.ez@hitachi.com
内線PHS: 874-2583
外線PHS: 050-3135-2583
-------------------------------------------------
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae.ez@hitachi.com



  reply	other threads:[~2013-07-19  5:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 23:19 [PATCH 0/2] [BUGFIX] virtio/console: Fix two bugs of splice_write Yoshihiro YUNOMAE
2013-07-18 23:19 ` [PATCH 1/2] [BUGFIX] virtio/console: Quit from splice_write if pipe->nrbufs is 0 Yoshihiro YUNOMAE
2013-07-18 23:19 ` [PATCH 2/2] [BUGFIX] virtio/console: Add pipe_lock/unlock for splice_write Yoshihiro YUNOMAE
2013-07-19  5:23   ` Amit Shah
2013-07-19  5:46     ` Yoshihiro YUNOMAE [this message]
2013-07-19  5:23 ` [PATCH 0/2] [BUGFIX] virtio/console: Fix two bugs of splice_write Amit Shah
2013-07-19  5:48   ` Yoshihiro YUNOMAE
2013-07-19  5:24 ` Amit Shah
2013-07-19  5:24   ` Amit Shah

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=51E8D2C3.80600@hitachi.com \
    --to=yoshihiro.yunomae.ez@hitachi.com \
    --cc=amit.shah@redhat.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=yrl.pp-manager.tt@hitachi.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.