Commit 15a8b55
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: 34b1744 ("nfsd4: define ->op_release for compound ops")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>1 parent 804d8e0 commit 15a8b55
2 files changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
300 | 301 | | |
301 | 302 | | |
302 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5400 | 5400 | | |
5401 | 5401 | | |
5402 | 5402 | | |
5403 | | - | |
5404 | | - | |
5405 | | - | |
5406 | | - | |
| 5403 | + | |
| 5404 | + | |
5407 | 5405 | | |
5408 | 5406 | | |
5409 | 5407 | | |
| |||
5418 | 5416 | | |
5419 | 5417 | | |
5420 | 5418 | | |
5421 | | - | |
5422 | | - | |
5423 | 5419 | | |
5424 | 5420 | | |
5425 | 5421 | | |
| |||
5460 | 5456 | | |
5461 | 5457 | | |
5462 | 5458 | | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
5463 | 5462 | | |
5464 | 5463 | | |
5465 | 5464 | | |
| |||
0 commit comments