raw_ip: validate inp

Post r335356 it is possible to have an inpcb on the hash lists that is
partially torn down. Validate before using.

Reported by:	pho
This commit is contained in:
Matt Macy 2018-06-21 17:24:10 +00:00
parent 63c4317055
commit e5c331cf78
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=335497

View File

@ -331,6 +331,10 @@ rip_input(struct mbuf **mp, int *offp, int proto)
}
INP_RLOCK(inp);
last = inp;
if (__predict_false(inp->inp_flags2 & INP_FREED)) {
last = NULL;
INP_RUNLOCK(inp);
}
}
CK_LIST_FOREACH(inp, &V_ripcbinfo.ipi_hashbase[0], inp_hash) {
if (inp->inp_ip_p && inp->inp_ip_p != proto)