When a partition was unpublished from devfs the devfs_delete_vnode() would
also free the device info which it must not do, as this info is in fact just a pointer to the device info of the raw node. Removing a raw device that had partitions published therefore always lead into KDL when closing the raw device after unpublising the partition, as the close_hook pointer which sits in the device info now was 0xdeadbeef. This should make for example unplugging USB devices work as expected. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24827 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a63f51dea4
commit
3568352d8d
@ -824,16 +824,19 @@ devfs_delete_vnode(struct devfs *fs, struct devfs_vnode *vnode,
|
||||
hash_remove(fs->vnode_hash, vnode);
|
||||
|
||||
if (S_ISCHR(vnode->stream.type)) {
|
||||
// for partitions, we have to release the raw device
|
||||
// for partitions, we have to release the raw device but must
|
||||
// not free the device info as it was inherited from the raw
|
||||
// device and is still in use there
|
||||
if (vnode->stream.u.dev.partition) {
|
||||
put_vnode(fs->volume,
|
||||
vnode->stream.u.dev.partition->raw_device->id);
|
||||
} else
|
||||
} else {
|
||||
delete vnode->stream.u.dev.scheduler;
|
||||
|
||||
// remove API conversion from old to new drivers
|
||||
if (vnode->stream.u.dev.node == NULL)
|
||||
free(vnode->stream.u.dev.info);
|
||||
// remove API conversion from old to new drivers
|
||||
if (vnode->stream.u.dev.node == NULL)
|
||||
free(vnode->stream.u.dev.info);
|
||||
}
|
||||
}
|
||||
|
||||
free(vnode->name);
|
||||
|
Loading…
Reference in New Issue
Block a user