selsocket: handle sopoll() errors correctly

Without this change, unmounting smbfs filesystems with an INVARIANTS
kernel would panic after 10e64782ed.

Found by:	markj
Reviewed by:	markj, jhb
Obtained from:	CheriBSD
MFC after:	3 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D32492
This commit is contained in:
Brooks Davis 2021-10-14 00:43:06 +01:00
parent a524aaf683
commit 04c91ac48a

View File

@ -1794,10 +1794,10 @@ selsocket(struct socket *so, int events, struct timeval *tvp, struct thread *td)
*/
for (;;) {
selfdalloc(td, NULL);
error = sopoll(so, events, NULL, td);
/* error here is actually the ready events. */
if (error)
return (0);
if (sopoll(so, events, NULL, td) != 0) {
error = 0;
break;
}
error = seltdwait(td, asbt, precision);
if (error)
break;