Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
d202c500
Unverified
Commit
d202c500
authored
Feb 18, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpf: fix return values in bpf_program_cgroup_attach()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
354d21c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
cgroup2_devices.c
src/lxc/cgroups/cgroup2_devices.c
+4
-4
No files found.
src/lxc/cgroups/cgroup2_devices.c
View file @
d202c500
...
@@ -385,14 +385,14 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
...
@@ -385,14 +385,14 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
if
(
prog
->
fd_cgroup
>=
0
)
{
if
(
prog
->
fd_cgroup
>=
0
)
{
if
(
prog
->
attached_type
!=
type
)
if
(
prog
->
attached_type
!=
type
)
return
log_error_errno
(
-
1
,
EBUSY
,
"Wrong type for bpf program"
);
return
syserrno_set
(
-
EBUSY
,
"Wrong type for bpf program"
);
/*
/*
* For BPF_F_ALLOW_OVERRIDE the flags of the new and old
* For BPF_F_ALLOW_OVERRIDE the flags of the new and old
* program must match.
* program must match.
*/
*/
if
((
flags
&
BPF_F_ALLOW_OVERRIDE
)
&&
(
prog
->
attached_flags
!=
flags
))
if
((
flags
&
BPF_F_ALLOW_OVERRIDE
)
&&
(
prog
->
attached_flags
!=
flags
))
return
log_error_errno
(
-
1
,
EBUSY
,
"Wrong flags for bpf program"
);
return
syserrno_set
(
-
EBUSY
,
"Wrong flags for bpf program"
);
}
}
/* Leave the caller's fd alone. */
/* Leave the caller's fd alone. */
...
@@ -402,7 +402,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
...
@@ -402,7 +402,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
ret
=
bpf_program_load_kernel
(
prog
);
ret
=
bpf_program_load_kernel
(
prog
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
log_error_errno
(
-
1
,
ret
,
"Failed to load bpf program"
);
return
syserrno
(
-
errno
,
"Failed to load bpf program"
);
attr
=
&
(
union
bpf_attr
){
attr
=
&
(
union
bpf_attr
){
.
attach_type
=
type
,
.
attach_type
=
type
,
...
@@ -416,7 +416,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
...
@@ -416,7 +416,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type, int fd_cgroup,
ret
=
bpf
(
BPF_PROG_ATTACH
,
attr
,
sizeof
(
*
attr
));
ret
=
bpf
(
BPF_PROG_ATTACH
,
attr
,
sizeof
(
*
attr
));
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserrno
_set
(
-
errno
,
"Failed to attach bpf program"
);
return
syserrno
(
-
errno
,
"Failed to attach bpf program"
);
swap
(
prog
->
fd_cgroup
,
fd_attach
);
swap
(
prog
->
fd_cgroup
,
fd_attach
);
prog
->
attached_type
=
type
;
prog
->
attached_type
=
type
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment