Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Feb 2022 17:18:22 -0900
From:      Rob Wing <rob.fx907@gmail.com>
To:        Michael Jung <mikej@paymentallianceintl.com>
Cc:        Hans Petter Selasky <hps@selasky.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: New panic in main-n253273-a52d8d4a6c6:
Message-ID:  <CAF3%2Bn_dsm0tK6_9pSJxwMVRxxGeAzps0BSx8MvqQdgGTbTFkYw@mail.gmail.com>
In-Reply-To: <794fbec71b714f6ea3931b942f17e1ea@MAIL-HUB.pai.local>
References:  <b7ca5b5e7a9a4df3951a2cb2f1d63552@MAIL-HUB.pai.local> <d04c0d93-8168-f53a-a5fd-865a1f6d2486@selasky.org> <6fcc161dd23b4f7ebe7cc789f11c017e@MAIL-HUB.pai.local> <dbd20a4d-b5a3-390e-a231-8ccca4f64c70@selasky.org> <924c13764ce342cf968ef9a93699be9a@MAIL-HUB.pai.local> <719aa03f-6f34-fdf8-1258-c7e5fcf33043@selasky.org> <794fbec71b714f6ea3931b942f17e1ea@MAIL-HUB.pai.local>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]

[-- Attachment #2 --]
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ebb32f698e88..e98b2d10b810 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -2083,6 +2083,8 @@ ttyhook_register(struct tty **rtp, struct proc *p, int fd, struct ttyhook *th,
 	FILEDESC_SLOCK(fdp);
 	error = fget_cap_locked(fdp, fd, cap_rights_init_one(&rights, CAP_TTYHOOK),
 	    &fp, NULL);
+	if (error == 0 && !fhold(fp))
+		return (EBADF);
 	FILEDESC_SUNLOCK(fdp);
 	if (error != 0)
 		return (error);

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF3%2Bn_dsm0tK6_9pSJxwMVRxxGeAzps0BSx8MvqQdgGTbTFkYw>