Unverified Commit 1521a350 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15424 bpf: bpf_local_storage: Always use bpf_mem_alloc in PREEMPT_RT

parents d7f2d2bf 70964fbd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -823,8 +823,12 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
	smap->elem_size = offsetof(struct bpf_local_storage_elem,
				   sdata.data[attr->value_size]);

	smap->bpf_ma = bpf_ma;
	if (bpf_ma) {
	/* In PREEMPT_RT, kmalloc(GFP_ATOMIC) is still not safe in non
	 * preemptible context. Thus, enforce all storages to use
	 * bpf_mem_alloc when CONFIG_PREEMPT_RT is enabled.
	 */
	smap->bpf_ma = IS_ENABLED(CONFIG_PREEMPT_RT) ? true : bpf_ma;
	if (smap->bpf_ma) {
		err = bpf_mem_alloc_init(&smap->selem_ma, smap->elem_size, false);
		if (err)
			goto free_smap;