stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: weiping zhang <zwp10758@gmail.com>
Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] virtio: release virtio index when fail to device_register
Date: Wed, 29 Nov 2017 15:55:45 +0200	[thread overview]
Message-ID: <20171129155501-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20171129012301.GA6637@localhost.didichuxing.com>

On Wed, Nov 29, 2017 at 09:23:01AM +0800, weiping zhang wrote:
> index can be reused by other virtio device.
> 
> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>

Thanks!
I've queued this up, this is needed on stable as well.


> ---
>  drivers/virtio/virtio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 48230a5..bf7ff39 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -333,6 +333,8 @@ int register_virtio_device(struct virtio_device *dev)
>  	/* device_register() causes the bus infrastructure to look for a
>  	 * matching driver. */
>  	err = device_register(&dev->dev);
> +	if (err)
> +		ida_simple_remove(&virtio_index_ida, dev->index);
>  out:
>  	if (err)
>  		virtio_add_status(dev, VIRTIO_CONFIG_S_FAILED);
> -- 
> 2.9.4

           reply	other threads:[~2017-11-29 13:55 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20171129012301.GA6637@localhost.didichuxing.com>]

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=20171129155501-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zwp10758@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).