deepakarumugam.s@nutanix.com has uploaded this change for review. ( https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1177971?usp=email ) Change subject: Remove from fd lru if open/reopen fails and fd is closed ...................................................................... Remove from fd lru if open/reopen fails and fd is closed Currently because we are inserting an fd into the lru and then doing the actual open/reopen - we could have situations where we track closed fds in the fd lru. The FSALs typically check if a fd is open before calling close_fsal_fd. This means that fds that are still in the fd lru can be freed. This leads to use after free scenarios. This was another bug we caught when we use asan build for ganesha We are calling fsal_reopen_fd from the same place under 2 scenarios (1) Actual open, the fd was previously closed. if actual open fails - fd remains closed and we end up storing the fd in the lru. (2) Reopen, the fd was previously open. We are reopening it with different flags. If there are failures during reopen today the FSALS don't close the previously open fds - which makes sense. It also makes sense to bump the fd in the lru irrespective of whether or not reopen failed. This patch handles the open error + above (2) scenarios by checking if the fsal closed the fd and removing it from the lru if it did. Change-Id: Iabc8254adaebf909e47740be1d955267958fedaa Signed-off-by: Deepak Arumugam Sankara Subramanian <deepakarumugam.s@nutanix.com> --- M src/FSAL/commonlib.c 1 file changed, 10 insertions(+), 0 deletions(-) git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/71/1177971/1 -- To view, visit https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/1177971?usp=email To unsubscribe, or for help writing mail filters, visit https://review.gerrithub.io/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: ffilz/nfs-ganesha Gerrit-Branch: next Gerrit-Change-Id: Iabc8254adaebf909e47740be1d955267958fedaa Gerrit-Change-Number: 1177971 Gerrit-PatchSet: 1 Gerrit-Owner: deepakarumugam.s@nutanix.com