@@ -3033,6 +3033,7 @@ struct bpf_uprobe_multi_link;
3033
3033
struct bpf_uprobe {
3034
3034
struct bpf_uprobe_multi_link * link ;
3035
3035
loff_t offset ;
3036
+ unsigned long ref_ctr_offset ;
3036
3037
u64 cookie ;
3037
3038
struct uprobe_consumer consumer ;
3038
3039
};
@@ -3172,7 +3173,6 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
3172
3173
{
3173
3174
struct bpf_uprobe_multi_link * link = NULL ;
3174
3175
unsigned long __user * uref_ctr_offsets ;
3175
- unsigned long * ref_ctr_offsets = NULL ;
3176
3176
struct bpf_link_primer link_primer ;
3177
3177
struct bpf_uprobe * uprobes = NULL ;
3178
3178
struct task_struct * task = NULL ;
@@ -3245,18 +3245,12 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
3245
3245
if (!uprobes || !link )
3246
3246
goto error_free ;
3247
3247
3248
- if (uref_ctr_offsets ) {
3249
- ref_ctr_offsets = kvcalloc (cnt , sizeof (* ref_ctr_offsets ), GFP_KERNEL );
3250
- if (!ref_ctr_offsets )
3251
- goto error_free ;
3252
- }
3253
-
3254
3248
for (i = 0 ; i < cnt ; i ++ ) {
3255
3249
if (ucookies && __get_user (uprobes [i ].cookie , ucookies + i )) {
3256
3250
err = - EFAULT ;
3257
3251
goto error_free ;
3258
3252
}
3259
- if (uref_ctr_offsets && __get_user (ref_ctr_offsets [i ], uref_ctr_offsets + i )) {
3253
+ if (uref_ctr_offsets && __get_user (uprobes [i ]. ref_ctr_offset , uref_ctr_offsets + i )) {
3260
3254
err = - EFAULT ;
3261
3255
goto error_free ;
3262
3256
}
@@ -3287,7 +3281,7 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
3287
3281
for (i = 0 ; i < cnt ; i ++ ) {
3288
3282
err = uprobe_register_refctr (d_real_inode (link -> path .dentry ),
3289
3283
uprobes [i ].offset ,
3290
- ref_ctr_offsets ? ref_ctr_offsets [i ] : 0 ,
3284
+ uprobes [i ]. ref_ctr_offset ,
3291
3285
& uprobes [i ].consumer );
3292
3286
if (err ) {
3293
3287
bpf_uprobe_unregister (& path , uprobes , i );
@@ -3299,11 +3293,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
3299
3293
if (err )
3300
3294
goto error_free ;
3301
3295
3302
- kvfree (ref_ctr_offsets );
3303
3296
return bpf_link_settle (& link_primer );
3304
3297
3305
3298
error_free :
3306
- kvfree (ref_ctr_offsets );
3307
3299
kvfree (uprobes );
3308
3300
kfree (link );
3309
3301
if (task )
0 commit comments