File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3628,8 +3628,10 @@ static int link_update(union bpf_attr *attr)
3628
3628
return PTR_ERR (link );
3629
3629
3630
3630
new_prog = bpf_prog_get (attr -> link_update .new_prog_fd );
3631
- if (IS_ERR (new_prog ))
3632
- return PTR_ERR (new_prog );
3631
+ if (IS_ERR (new_prog )) {
3632
+ ret = PTR_ERR (new_prog );
3633
+ goto out_put_link ;
3634
+ }
3633
3635
3634
3636
if (flags & BPF_F_REPLACE ) {
3635
3637
old_prog = bpf_prog_get (attr -> link_update .old_prog_fd );
@@ -3638,6 +3640,9 @@ static int link_update(union bpf_attr *attr)
3638
3640
old_prog = NULL ;
3639
3641
goto out_put_progs ;
3640
3642
}
3643
+ } else if (attr -> link_update .old_prog_fd ) {
3644
+ ret = - EINVAL ;
3645
+ goto out_put_progs ;
3641
3646
}
3642
3647
3643
3648
#ifdef CONFIG_CGROUP_BPF
@@ -3653,6 +3658,8 @@ static int link_update(union bpf_attr *attr)
3653
3658
bpf_prog_put (old_prog );
3654
3659
if (ret )
3655
3660
bpf_prog_put (new_prog );
3661
+ out_put_link :
3662
+ bpf_link_put (link );
3656
3663
return ret ;
3657
3664
}
3658
3665
You can’t perform that action at this time.
0 commit comments