> > @@ -3454,15 +3460,26 @@ static struct sock *bpf_iter_udp_batch(struct seq_file *seq) > > batch_sks++; > > } > > } > > - spin_unlock_bh(&hslot2->lock); > > > > if (iter->end_sk) > > break; > > +next_bucket: > > + /* Somehow the bucket was emptied or all matching sockets were > > + * removed while we held onto its lock. This should not happen. > > + */ > > + if (WARN_ON_ONCE(!resizes)) > > + /* Best effort; reset the resize budget and move on. */ > > + resizes = MAX_REALLOC_ATTEMPTS; > > + if (lock) > > + spin_unlock_bh(lock); > > + lock = NULL; > > } > > > > /* All done: no batch made. */ > > if (!iter->end_sk) > > - return NULL; > > + goto done; > > If we jump here when no UDP socket exists, uninitialised sk is returned. > Maybe move this condition down below the sk initialisation. In this case, we'd want to return NULL just like it did before, since there's no socket in the batch. Do you want me to make this more explicit by setting sk = NULL here? -Jordan