From: Alexandr Nedvedicky Subject: Re: link mbufs/inpcbs to pf_states, not pf_state_keys To: David Gwynne Cc: tech@openbsd.org Date: Fri, 30 Jan 2026 00:36:55 +0100 Hello, On Thu, Jan 29, 2026 at 01:50:19AM +0100, Alexandr Nedvedicky wrote: > Hello, > > On Thu, Jan 29, 2026 at 06:40:01AM +1000, David Gwynne wrote: > > > > > this chunk makes more sense if you can see more context. > > > > 1296 int > > 1297 pf_state_insert(struct pfi_kif *kif, struct pf_state_key **skwp, > > 1298 struct pf_state_key **sksp, struct pf_state *st) > > 1299 { > > 1300 struct pf_state_key *skw = *skwp; > > 1301 struct pf_state_key *sks = *sksp; > > 1302 int same = (skw == sks); > > 1303 > > 1304 PF_ASSERT_LOCKED(); > > 1305 > > 1306 st->kif = kif; > > 1307 PF_STATE_ENTER_WRITE(); > > 1308 > > 1309 skw = pf_state_key_attach(skw, st, PF_SK_WIRE); > > 1310 if (skw == NULL) { > > 1311 pf_state_key_unref(sks); > > 1312 PF_STATE_EXIT_WRITE(); > > 1313 return (-1); > > 1314 } > > 1315 > > 1316 if (same) { > > 1317 /* pf_state_key_attach might have swapped skw */ > > 1318 if (skw != sks) { > > 1319 pf_state_key_unref(sks); > > 1320 sks = pf_state_key_ref(skw); may be we should do *sksp = sks; here if when running through this branch, so things are consistent for caller. thanks and regards sashan