https://github.com/torvalds/linux
Revision 4659ed7cc8514369043053463514408ca16ad6f3 authored by Tom Rix on 12 June 2020, 22:45:49 UTC, committed by Anna Schumaker on 26 June 2020, 12:43:14 UTC
The try_location function is called within a loop by nfs_follow_referral.
try_location calls nfs4_pathname_string to created the export_path.
nfs4_pathname_string allocates the memory. export_path is stored in the
nfs_fs_context/fs_context structure similarly as hostname and source.
But whereas the ctx hostname and source are freed before assignment,
export_path is not.  So if there are multiple loops, the new export_path
will overwrite the old without the old being freed.

So call kfree for export_path.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent b7ade38
History
Tip revision: 4659ed7cc8514369043053463514408ca16ad6f3 authored by Tom Rix on 12 June 2020, 22:45:49 UTC
nfs: Fix memory leak of export_path
Tip revision: 4659ed7
File Mode Size
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format -rw-r--r-- 15.8 KB
.cocciconfig -rw-r--r-- 59 bytes
.get_maintainer.ignore -rw-r--r-- 71 bytes
.gitattributes -rw-r--r-- 62 bytes
.gitignore -rw-r--r-- 1.8 KB
.mailmap -rw-r--r-- 15.4 KB
COPYING -rw-r--r-- 496 bytes
CREDITS -rw-r--r-- 97.4 KB
Kbuild -rw-r--r-- 1.3 KB
Kconfig -rw-r--r-- 555 bytes
MAINTAINERS -rw-r--r-- 547.7 KB
Makefile -rw-r--r-- 60.4 KB
README -rw-r--r-- 727 bytes

README

back to top