git: cdae9b8e4377 - stable/13 - LinuxKPI: Invoke release handler when file is destroyed by fput()

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Wed, 13 Oct 2021 09:19:12 UTC
The branch stable/13 has been updated by wulf:

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

commit cdae9b8e4377937f4c79386727a46a414b515f11
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-09-29 20:13:27 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2021-10-13 09:01:06 +0000

    LinuxKPI: Invoke release handler when file is destroyed by fput()
    
    Required by drm_kmod 5.6
    
    Reviewed by:    hselasky, manu
    MFC after:      2 weeks
    Differential revision:  https://reviews.freebsd.org/D32067
    
    (cherry picked from commit 7d92d4835850fdc5c1ec1fa7c5634826a61ad0a5)
---
 sys/compat/linuxkpi/common/src/linux_compat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index c48d9ac3a281..247c1f54515e 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -470,6 +470,8 @@ void
 linux_file_free(struct linux_file *filp)
 {
 	if (filp->_file == NULL) {
+		if (filp->f_op != NULL && filp->f_op->release != NULL)
+			filp->f_op->release(filp->f_vnode, filp);
 		if (filp->f_shmem != NULL)
 			vm_object_deallocate(filp->f_shmem);
 		kfree_rcu(filp, rcu);