]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vn_open_vnode(): handle error when fp == NULL
authorKonstantin Belousov <kib@FreeBSD.org>
Mon, 19 Apr 2021 10:25:30 +0000 (13:25 +0300)
committerKonstantin Belousov <kib@FreeBSD.org>
Wed, 21 Apr 2021 15:06:51 +0000 (18:06 +0300)
commit54f98c4dbf9b1203a4e3e1b13fd0738441226991
tree484ff3b37934e2d79ad9d8598b0330ff0b7a107f
parent45aec46246fe61a3f45cf7da1c80850dc226f609
vn_open_vnode(): handle error when fp == NULL

If VOP_ADD_WRITECOUNT() or adv locking failed, so VOP_CLOSE() needs to
be called, we cannot use fp fo_close() when there is no fp.  This occurs
when e.g. kernel code directly calls vn_open() instead of the open(2)
syscall.

In this case, VOP_CLOSE() can be called directly, after possible lock
upgrade.

Reported by: nvass@gmx.com
PR: 255119
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29830
sys/kern/vfs_vnops.c