All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	torvalds@linux-foundation.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH v2 (resend #3)] hvc_console: Fix race between hvc_close and hvc_remove
Date: Fri, 12 Mar 2010 07:52:13 -0800	[thread overview]
Message-ID: <20100312155213.GA3626@kroah.com> (raw)
In-Reply-To: <1268374995-20722-1-git-send-email-amit.shah@redhat.com>

On Fri, Mar 12, 2010 at 11:53:15AM +0530, Amit Shah wrote:
> Alan pointed out a race in the code where hvc_remove is invoked. The
> recent virtio_console work is the first user of hvc_remove().
> 
> Alan describes it thus:
> 
> The hvc_console assumes that a close and remove call can't occur at the
> same time.
> 
> In addition tty_hangup(tty) is problematic as tty_hangup is asynchronous
> itself....
> 
> So this can happen
> 
>         hvc_close                               hvc_remove
>         hung up ? - no
>                                                 lock
>                                                 tty = hp->tty
>                                                 unlock
>         lock
>         hp->tty = NULL
>         unlock
>         notify del
>         kref_put the hvc struct
>         close completes
>         tty is destroyed
>                                                 tty_hangup dead tty
>                                                 tty->ops will be NULL
>                                                 NULL->...
> 
> This patch adds some tty krefs and also converts to using tty_vhangup().
> 
> Reported-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> CC: Alan Cox <alan@lxorguk.ukuu.org.uk>
> CC: linuxppc-dev@ozlabs.org
> CC: Rusty Russell <rusty@rustcorp.com.au>
> ---
> 
> Linus, sending to you this time as I didn't receive any response from
> Ben or Greg for the previous submissions.

It's in my "to-apply" queue.  Which I was ignoring due to the -rc1
merge, and then I've been busy with -stable stuff and a conference this
week.  I'll get to it soon.

thanks for your patience,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg KH <greg@kroah.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: linux-kernel@vger.kernel.org, benh@kernel.crashing.org,
	torvalds@linux-foundation.org,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linuxppc-dev@ozlabs.org, Rusty Russell <rusty@rustcorp.com.au>
Subject: Re: [PATCH v2 (resend #3)] hvc_console: Fix race between hvc_close and hvc_remove
Date: Fri, 12 Mar 2010 07:52:13 -0800	[thread overview]
Message-ID: <20100312155213.GA3626@kroah.com> (raw)
In-Reply-To: <1268374995-20722-1-git-send-email-amit.shah@redhat.com>

On Fri, Mar 12, 2010 at 11:53:15AM +0530, Amit Shah wrote:
> Alan pointed out a race in the code where hvc_remove is invoked. The
> recent virtio_console work is the first user of hvc_remove().
> 
> Alan describes it thus:
> 
> The hvc_console assumes that a close and remove call can't occur at the
> same time.
> 
> In addition tty_hangup(tty) is problematic as tty_hangup is asynchronous
> itself....
> 
> So this can happen
> 
>         hvc_close                               hvc_remove
>         hung up ? - no
>                                                 lock
>                                                 tty = hp->tty
>                                                 unlock
>         lock
>         hp->tty = NULL
>         unlock
>         notify del
>         kref_put the hvc struct
>         close completes
>         tty is destroyed
>                                                 tty_hangup dead tty
>                                                 tty->ops will be NULL
>                                                 NULL->...
> 
> This patch adds some tty krefs and also converts to using tty_vhangup().
> 
> Reported-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> CC: Alan Cox <alan@lxorguk.ukuu.org.uk>
> CC: linuxppc-dev@ozlabs.org
> CC: Rusty Russell <rusty@rustcorp.com.au>
> ---
> 
> Linus, sending to you this time as I didn't receive any response from
> Ben or Greg for the previous submissions.

It's in my "to-apply" queue.  Which I was ignoring due to the -rc1
merge, and then I've been busy with -stable stuff and a conference this
week.  I'll get to it soon.

thanks for your patience,

greg k-h

  reply	other threads:[~2010-03-12 15:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-03 15:29 [PATCH v2] hvc_console: Fix race between hvc_close and hvc_remove Amit Shah
2010-03-03 15:29 ` Amit Shah
2010-03-03 15:55 ` Alan Cox
2010-03-03 15:55   ` Alan Cox
2010-03-04  2:44   ` Amit Shah
2010-03-04  2:44     ` Amit Shah
2010-03-08  3:38     ` [PATCH v2 (resend)] " Amit Shah
2010-03-08  3:38       ` Amit Shah
2010-03-12  6:23       ` [PATCH v2 (resend #3)] " Amit Shah
2010-03-12  6:23         ` Amit Shah
2010-03-12 15:52         ` Greg KH [this message]
2010-03-12 15:52           ` Greg KH

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=20100312155213.GA3626@kroah.com \
    --to=greg@kroah.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=amit.shah@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    /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.