mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
IB/uverbs: Allow all DESTROY commands to succeed after disassociate
The disassociate function was broken by design because it failed all commands. This prevents userspace from calling destroy on a uobject after it has detected a device fatal error and thus reclaiming the resources in userspace is prevented. This fix is now straightforward, when anything destroys a uobject that is not the user the object remains on the IDR with a NULL context and object pointer. All lookup locking modes other than DESTROY will fail. When the user ultimately calls the destroy function it is simply dropped from the IDR while any related information is returned. Signed-off-by: Jason Gunthorpe <[email protected]>
This commit is contained in:
parent
a9b66d6453
commit
0f50d88a6e
4 changed files with 66 additions and 16 deletions
|
|
@ -61,6 +61,7 @@ enum rdma_lookup_mode {
|
|||
* Destruction flow:
|
||||
* lookup_get(exclusive=true) & uverbs_try_lock_object
|
||||
* remove_commit
|
||||
* remove_handle (optional)
|
||||
* lookup_put(exclusive=true) via rdma_lookup_put_uobject
|
||||
*
|
||||
* Allocate Error flow #1
|
||||
|
|
@ -92,8 +93,9 @@ struct uverbs_obj_type_class {
|
|||
enum rdma_lookup_mode mode);
|
||||
void (*lookup_put)(struct ib_uobject *uobj, enum rdma_lookup_mode mode);
|
||||
/* This does not consume the kref on uobj */
|
||||
int __must_check (*remove_commit)(struct ib_uobject *uobj,
|
||||
enum rdma_remove_reason why);
|
||||
int __must_check (*destroy_hw)(struct ib_uobject *uobj,
|
||||
enum rdma_remove_reason why);
|
||||
void (*remove_handle)(struct ib_uobject *uobj);
|
||||
u8 needs_kfree_rcu;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue