Files
linux/fs/nfsd
Kinglong Mee a1f05514b0 NFS4: Avoid NULL reference or double free in nfsd4_fslocs_free()
If fsloc_parse() failed at kzalloc(), fs/nfsd/export.c
 411
 412         fsloc->locations = kzalloc(fsloc->locations_count
 413                         * sizeof(struct nfsd4_fs_location), GFP_KERNEL);
 414         if (!fsloc->locations)
 415                 return -ENOMEM;

svc_export_parse() will call nfsd4_fslocs_free() with fsloc->locations = NULL,
so that, "kfree(fsloc->locations[i].path);" will cause a crash.

If fsloc_parse() failed after that, fsloc_parse() will call nfsd4_fslocs_free(),
and svc_export_parse() will call it again, so that, a double free is caused.

This patch checks the fsloc->locations, and set to NULL after it be freed.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2014-05-30 17:32:18 -04:00
..
2013-10-26 15:37:26 -04:00
2011-11-07 21:10:47 -05:00
2013-02-26 02:46:08 -05:00
2013-10-24 23:34:51 -04:00
2014-05-08 12:43:03 -04:00
2014-05-06 17:54:53 -04:00
2013-02-26 02:46:08 -05:00
2014-05-30 17:32:09 -04:00
2014-05-30 17:32:09 -04:00
2014-05-30 17:32:03 -04:00