Skip to content

Commit a8eb8a0

Browse files
committed
Merge branch 'io_uring-7.0' into for-next
* io_uring-7.0: io_uring/bpf_filters: retain COW'ed settings on parse failures
2 parents 4368fc6 + 876a3cd commit a8eb8a0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

io_uring/register.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,17 @@ static __cold int io_register_restrictions(struct io_ring_ctx *ctx,
178178
return -EBUSY;
179179

180180
ret = io_parse_restrictions(arg, nr_args, &ctx->restrictions);
181-
/* Reset all restrictions if an error happened */
181+
/*
182+
* Reset all restrictions if an error happened, but retain any COW'ed
183+
* settings.
184+
*/
182185
if (ret < 0) {
186+
struct io_bpf_filters *bpf = ctx->restrictions.bpf_filters;
187+
bool cowed = ctx->restrictions.bpf_filters_cow;
188+
183189
memset(&ctx->restrictions, 0, sizeof(ctx->restrictions));
190+
ctx->restrictions.bpf_filters = bpf;
191+
ctx->restrictions.bpf_filters_cow = cowed;
184192
return ret;
185193
}
186194
if (ctx->restrictions.op_registered)

0 commit comments

Comments
 (0)