diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2012-11-09 14:54:12 +1030 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-26 12:14:06 -0800 |
commit | 01ae49199e6a67075b53150ecd8dfc627a67183b (patch) | |
tree | b0254e25c2906f62aa7294e75688a6ccc7d662be /fs | |
parent | 17773c7701fe1eb68b8841f215b506dca07a3b6a (diff) |
virtio: Don't access index after unregister.
commit 237242bddc99041e15a4ca51b8439657cadaff17 upstream.
Virtio wants to release used indices after the corresponding
virtio device has been unregistered. However, virtio does not
hold an extra reference, giving up its last reference with
device_unregister(), making accessing dev->index afterwards
invalid.
I actually saw problems when testing my (not-yet-merged)
virtio-ccw code:
- device_add virtio-net,id=xxx
-> creates device virtio<n> with n>0
- device_del xxx
-> deletes virtio<n>, but calls ida_simple_remove with an
index of 0
- device_add virtio-net,id=xxx
-> tries to add virtio0, which is still in use...
So let's save the index we want to release before calling
device_unregister().
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions