Jim Chen has uploaded this change for review.

View Change

grpc_server: fix NULL deref, mutex leak, and export removal in RemoveExport

In ExportService::RemoveExport():
1. If EXPORT_ADMIN_TRYLOCK() fails, put_gsh_export(export_obj) was
called while export_obj was still NULL, causing a NULL pointer
dereference.
2. On lookup_export() failure or pseudo-root / ID 0 rejection, the
function returned without calling EXPORT_ADMIN_UNLOCK(), leaving
export_admin_mutex permanently locked.
3. Checking export_obj->pseudopath without a NULL check could crash if
pseudopath is NULL.
4. Setting config_gen = 0 and calling synchronize_exports(generation)
failed to remove an export whose config_gen was already 0 and could
prune unrelated exports.

Remove the NULL put_gsh_export() call, unlock EXPORT_ADMIN_UNLOCK() on
all error paths, check pseudopath != NULL, and call
release_export(export_obj, false) directly.

Change-Id: I4b677a6b4ea7085d28321a338bb58185518cccbb
Signed-off-by: Jim Chen <czcbangkai@google.com>
---
M src/grpc_server/nfsServiceServer.cc
1 file changed, 9 insertions(+), 15 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/28/1257728/1

To view, visit change 1257728. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: I4b677a6b4ea7085d28321a338bb58185518cccbb
Gerrit-Change-Number: 1257728
Gerrit-PatchSet: 1
Gerrit-Owner: Jim Chen <czcbangkai@google.com>