Xiaotian Feng
9699eda6bc
nfs: fix memory leak in nfs_get_sb with CONFIG_NFS_V4
With CONFIG_NFS_V4 and data version 4, nfs_get_sb will allocate memory for
export_path in nfs4_validate_text_mount_data, so we need to free it then.
This is addressed in following kmemleak report:
unreferenced object 0xffff88016bf48a50 (size 16):
comm "mount.nfs", pid 22567, jiffies 4651574704 (age 175471.200s)
hex dump (first 16 bytes):
2f 6f 70 74 2f 77 6f 72 6b 00 6b 6b 6b 6b 6b a5 /opt/work.kkkkk.
backtrace:
[<ffffffff814b34f9>] kmemleak_alloc+0x60/0xa7
[<ffffffff81102c76>] kmemleak_alloc_recursive.clone.5+0x1b/0x1d
[<ffffffff811046b3>] __kmalloc_track_caller+0x18f/0x1b7
[<ffffffff810e1b08>] kstrndup+0x37/0x54
[<ffffffffa0336971>] nfs_parse_devname+0x152/0x204 [nfs]
[<ffffffffa0336af3>] nfs4_validate_text_mount_data+0xd0/0xdc [nfs]
[<ffffffffa0338deb>] nfs_get_sb+0x325/0x736 [nfs]
[<ffffffff81113671>] vfs_kern_mount+0xbd/0x17c
[<ffffffff81113798>] do_kern_mount+0x4d/0xed
[<ffffffff81129a87>] do_mount+0x787/0x7fe
[<ffffffff81129b86>] sys_mount+0x88/0xc2
[<ffffffff81009b42>] system_call_fastpath+0x16/0x1b
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Benny Halevy <bhalevy@panasas.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2010-04-28 13:46:28 -04:00
..
2010-03-30 22:02:32 +09:00
2009-08-19 18:22:15 -04:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2010-01-26 17:56:43 -05:00
2010-02-10 08:30:59 -05:00
2010-04-22 15:35:56 -04:00
2010-03-30 22:02:32 +09:00
2010-03-10 15:21:44 -05:00
2010-04-22 15:35:55 -04:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2009-08-19 18:22:15 -04:00
2010-03-30 22:02:32 +09:00
2009-04-03 16:42:44 +01:00
2010-03-30 22:02:32 +09:00
2009-09-23 14:36:39 -04:00
2009-07-08 09:31:56 -07:00
2009-08-09 15:14:24 -04:00
2010-04-09 19:08:16 -04:00
2010-03-05 13:25:52 -05:00
2010-02-17 11:17:38 +09:00
2010-02-26 17:22:35 -08:00
2009-08-19 18:22:15 -04:00
2010-02-09 14:29:29 -05:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2010-03-30 22:02:32 +09:00
2010-02-10 08:30:59 -05:00
2010-03-30 22:02:32 +09:00
2010-04-28 13:45:12 -04:00
2010-03-02 12:44:07 -05:00
2010-03-02 13:06:21 -05:00
2010-03-30 22:02:32 +09:00
2009-06-17 18:02:13 -07:00
2010-03-11 09:19:35 -05:00
2010-03-30 22:02:32 +09:00
2009-12-07 09:00:24 -05:00
2010-04-28 13:46:28 -04:00
2010-03-30 22:02:32 +09:00
2010-01-26 15:42:11 -05:00
2009-12-07 09:00:24 -05:00
2010-04-27 18:33:54 -04:00