Skip to content

Commit feec576

Browse files
committed
IB: When attrs.udata/ufile is available use that instead of uobject
The ucontext and ufile should not be accessed via the uobject, all these cases have an attrs so use that instead. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
1 parent e79c9c6 commit feec576

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎drivers/infiniband/core/rdma_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
128128
enum rdma_remove_reason reason,
129129
struct uverbs_attr_bundle *attrs)
130130
{
131-
struct ib_uverbs_file *ufile = uobj->ufile;
131+
struct ib_uverbs_file *ufile = attrs->ufile;
132132
unsigned long flags;
133133
int ret;
134134

@@ -200,7 +200,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
200200
*/
201201
int uobj_destroy(struct ib_uobject *uobj, struct uverbs_attr_bundle *attrs)
202202
{
203-
struct ib_uverbs_file *ufile = uobj->ufile;
203+
struct ib_uverbs_file *ufile = attrs->ufile;
204204
int ret;
205205

206206
down_read(&ufile->hw_destroy_rwsem);
@@ -655,7 +655,7 @@ static int alloc_commit_fd_uobject(struct ib_uobject *uobj)
655655
int __must_check rdma_alloc_commit_uobject(struct ib_uobject *uobj,
656656
struct uverbs_attr_bundle *attrs)
657657
{
658-
struct ib_uverbs_file *ufile = uobj->ufile;
658+
struct ib_uverbs_file *ufile = attrs->ufile;
659659
int ret;
660660

661661
/* alloc_commit consumes the uobj kref */

‎drivers/infiniband/core/uverbs_std_types_counters.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(
5454
{
5555
struct ib_uobject *uobj = uverbs_attr_get_uobject(
5656
attrs, UVERBS_ATTR_CREATE_COUNTERS_HANDLE);
57-
struct ib_device *ib_dev = uobj->context->device;
57+
struct ib_device *ib_dev = attrs->context->device;
5858
struct ib_counters *counters;
5959
int ret;
6060

‎drivers/infiniband/core/uverbs_std_types_cq.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_CQ_CREATE)(
6464
struct ib_ucq_object *obj = container_of(
6565
uverbs_attr_get_uobject(attrs, UVERBS_ATTR_CREATE_CQ_HANDLE),
6666
typeof(*obj), uobject);
67-
struct ib_device *ib_dev = obj->uobject.context->device;
67+
struct ib_device *ib_dev = attrs->context->device;
6868
int ret;
6969
u64 user_handle;
7070
struct ib_cq_init_attr attr = {};

‎drivers/infiniband/core/uverbs_std_types_dm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(
5555
struct ib_uobject *uobj =
5656
uverbs_attr_get(attrs, UVERBS_ATTR_ALLOC_DM_HANDLE)
5757
->obj_attr.uobject;
58-
struct ib_device *ib_dev = uobj->context->device;
58+
struct ib_device *ib_dev = attrs->context->device;
5959
struct ib_dm *dm;
6060
int ret;
6161

@@ -72,7 +72,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(
7272
if (ret)
7373
return ret;
7474

75-
dm = ib_dev->ops.alloc_dm(ib_dev, uobj->context, &attr, attrs);
75+
dm = ib_dev->ops.alloc_dm(ib_dev, attrs->context, &attr, attrs);
7676
if (IS_ERR(dm))
7777
return PTR_ERR(dm);
7878

‎drivers/infiniband/core/uverbs_std_types_flow_action.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_FLOW_ACTION_ESP_CREATE)(
310310
{
311311
struct ib_uobject *uobj = uverbs_attr_get_uobject(
312312
attrs, UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE);
313-
struct ib_device *ib_dev = uobj->context->device;
313+
struct ib_device *ib_dev = attrs->context->device;
314314
int ret;
315315
struct ib_flow_action *action;
316316
struct ib_flow_action_esp_attr esp_attr = {};

‎include/rdma/uverbs_std_types.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ __uobj_alloc(const struct uverbs_api_object *obj,
128128
rdma_alloc_begin_uobject(obj, attrs->ufile, attrs);
129129

130130
if (!IS_ERR(uobj))
131-
*ib_dev = uobj->context->device;
131+
*ib_dev = attrs->context->device;
132132
return uobj;
133133
}
134134

0 commit comments

Comments
 (0)