diff options
author | Jeff Layton <jlayton@kernel.org> | 2023-03-27 12:21:37 +0200 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-03-31 23:29:49 +0200 |
commit | 15a8b55dbb1ba154d82627547c5761cac884d810 (patch) | |
tree | 888903dafac5768b218da64da4d0e1bc7e21e319 /lib/trace_readwrite.c | |
parent | NFSD: Avoid calling OPDESC() with ops->opnum == OP_ILLEGAL (diff) | |
download | linux-15a8b55dbb1ba154d82627547c5761cac884d810.tar.xz linux-15a8b55dbb1ba154d82627547c5761cac884d810.zip |
nfsd: call op_release, even when op_func returns an error
For ops with "trivial" replies, nfsd4_encode_operation will shortcut
most of the encoding work and skip to just marshalling up the status.
One of the things it skips is calling op_release. This could cause a
memory leak in the layoutget codepath if there is an error at an
inopportune time.
Have the compound processing engine always call op_release, even when
op_func sets an error in op->status. With this change, we also need
nfsd4_block_get_device_info_scsi to set the gd_device pointer to NULL
on error to avoid a double free.
Reported-by: Zhi Li <yieli@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2181403
Fixes: 34b1744c91cc ("nfsd4: define ->op_release for compound ops")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'lib/trace_readwrite.c')
0 files changed, 0 insertions, 0 deletions