Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Oct 2021 23:20:35 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: 3b55b6137195 - stable/13 - selsocket: handle sopoll() errors correctly
Message-ID:  <202110192320.19JNKZIS031272@gitrepo.freebsd.org>

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

URL: https://cgit.FreeBSD.org/src/commit/?id=3b55b6137195ee116680590c1d3c4416a88fee2e

commit 3b55b6137195ee116680590c1d3c4416a88fee2e
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2021-10-19 23:19:57 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2021-10-19 23:19:57 +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 09c60611e755..0fcb93545e86 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -1709,10 +1709,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?202110192320.19JNKZIS031272>