The kernel may do unbalanced calls to fifo_close() for fifo vnode,

without corresponding number of fifo_open(). This causes assertion
failure in fifo_close() due to vp->v_fifoinfo being NULL for kernel
with INVARIANTS, or NULL pointer dereference otherwise. In fact, we may
ignore excess calls to fifo_close() without bad consequences.

Turn KASSERT() into the return, and print warning for now.

Tested by:	pho
Reviewed by:	rwatson
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2009-01-26 14:21:00 +00:00
parent 34bb786889
commit e442a285a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=187715

View File

@ -423,7 +423,10 @@ fifo_close(ap)
struct fifoinfo *fip = vp->v_fifoinfo;
ASSERT_VOP_LOCKED(vp, "fifo_close");
KASSERT(fip != NULL, ("fifo_close: no v_fifoinfo"));
if (fip == NULL) {
printf("fifo_close: no v_fifoinfo %p\n", vp);
return (0);
}
if (ap->a_fflag & FREAD) {
fip->fi_readers--;
if (fip->fi_readers == 0)