Unverified Commit 5d590c4c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12301 bpf: Fix use-after-free in bpf_uprobe_multi_link_attach()

parents 6163d2da 56e36f56
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3283,17 +3283,20 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
					     uprobes[i].ref_ctr_offset,
					     &uprobes[i].consumer);
		if (err) {
			bpf_uprobe_unregister(&path, uprobes, i);
			goto error_free;
			link->cnt = i;
			goto error_unregister;
		}
	}

	err = bpf_link_prime(&link->link, &link_primer);
	if (err)
		goto error_free;
		goto error_unregister;

	return bpf_link_settle(&link_primer);

error_unregister:
	bpf_uprobe_unregister(&path, uprobes, link->cnt);

error_free:
	kvfree(uprobes);
	kfree(link);