Bharath Vedartham 962a991c5d 9p/cache.c: Fix memory leak in v9fs_cache_session_get_cookie
v9fs_cache_session_get_cookie assigns a random cachetag to v9ses->cachetag,
if the cachetag is not assigned previously.

v9fs_random_cachetag allocates memory to v9ses->cachetag with kmalloc and uses
scnprintf to fill it up with a cachetag.

But if scnprintf fails, v9ses->cachetag is not freed in the current
code causing a memory leak.

Fix this by freeing v9ses->cachetag it v9fs_random_cachetag fails.

This was reported by syzbot, the link to the report is below:
https://syzkaller.appspot.com/bug?id=f012bdf297a7a4c860c38a88b44fbee43fd9bbf3

Link: http://lkml.kernel.org/r/20190522194519.GA5313@bharath12345-Inspiron-5559
Reported-by: syzbot+3a030a73b6c1e9833815@syzkaller.appspotmail.com
Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
2019-09-03 11:07:39 +00:00
..
2019-08-18 09:51:48 -07:00
2019-08-27 17:29:56 -05:00
2019-07-12 17:37:53 -07:00
2019-07-12 16:54:37 -07:00
2019-07-30 13:15:39 -07:00
2019-08-09 16:56:12 +01:00
2019-07-25 11:05:11 +02:00
2019-07-03 17:52:09 -04:00
2019-06-21 09:58:42 -07:00
\n
2019-07-10 20:27:07 -07:00
\n
2019-07-10 20:09:17 -07:00
\n
2019-07-10 20:27:07 -07:00
2019-08-15 11:09:16 -06:00
2019-07-15 21:20:52 -07:00
2019-05-21 08:23:41 +01:00
2019-04-08 18:21:02 -05:00
2019-03-08 14:48:40 -08:00
2019-07-12 16:54:37 -07:00
2019-07-10 21:22:43 -07:00
2019-02-07 16:38:35 +01:00
2019-07-31 12:22:32 -04:00