Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Oct 2021 16:01:01 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2f022558ce3d - stable/12 - selsocket: handle sopoll() errors correctly
Message-ID:  <202110201601.19KG115r066973@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f022558ce3d00eb53fd235dd87db780acd9bc25

commit 2f022558ce3d00eb53fd235dd87db780acd9bc25
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-10-20 16:00:38 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-10-20 16:00:38 +0000

    selsocket: handle sopoll() errors correctly
    
    Without this change, unmounting smbfs filesystems with an INVARIANTS
    kernel would panic after 10e64782ed59727e8c9fe4a5c7e17f497903c8eb.
    
    PR:             253079
    Found by:       markj
    Reviewed by:    markj, jhb
    Obtained from:  CheriBSD
    Sponsored by:   DARPA
    Differential Revision:  https://reviews.freebsd.org/D32492
    
    (cherry picked from commit 04c91ac48ad13ce0d1392cedbd69c2c0223d206f)
---
 sys/kern/sys_generic.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index fcdd5604583e..0840456f582f 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1596,10 +1596,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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110201601.19KG115r066973>