On Fri, Nov 11, 2022 at 8:31 AM Yonghong Song <yhs@xxxxxxxx> wrote: > > > > On 11/10/22 10:34 PM, Hou Tao wrote: > > From: Hou Tao <houtao1@xxxxxxxxxx> > > > > For many bpf iterator (e.g., cgroup iterator), iterator link acquires > > the reference of iteration target in .attach_target(), but iterator link > > may be closed before or in the middle of iteration, so iterator will > > need to acquire the reference of iteration target as well to prevent > > potential use-after-free. To avoid doing the acquisition in > > .init_seq_private() for each iterator type, just pin iterator link in > > iterator. > > > > Fixes: d4ccaf58a847 ("bpf: Introduce cgroup iter") > > Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx> > > Thanks. LGTM. Once this patch went through bpf and circulated back to > bpf-next, you can revert the change for the following patches: > f0d2b2716d71 bpf: Acquire map uref in .init_seq_private for > sock{map,hash} iterator > 3c5f6e698b5c bpf: Acquire map uref in .init_seq_private for sock > local storage map iterator > ef1e93d2eeb5 bpf: Acquire map uref in .init_seq_private for hash > map iterator > f76fa6b33805 bpf: Acquire map uref in .init_seq_private for array > map iterator > in bpf-next. > > Acked-by: Yonghong Song <yhs@xxxxxx> Acked-by: Hao Luo <haoluo@xxxxxxxxxx> Thanks!