linux_dsm_epyc7002/net/kcm
WANG Cong c0338aff22 kcm: fix a socket double free
Dmitry reported a double free on kcm socket, which could
be easily reproduced by:

	#include <unistd.h>
	#include <sys/syscall.h>

	int main()
	{
	  int fd = syscall(SYS_socket, 0x29ul, 0x5ul, 0x0ul, 0, 0, 0);
	  syscall(SYS_ioctl, fd, 0x89e2ul, 0x20a98000ul, 0, 0, 0);
	  return 0;
	}

This is because on the error path, after we install
the new socket file, we call sock_release() to clean
up the socket, which leaves the fd pointing to a freed
socket. Fix this by calling sys_close() on that fd
directly.

Fixes: ab7ac4eb98 ("kcm: Kernel Connection Multiplexor module")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-08-31 21:00:19 -07:00
..
kcmproc.c kcm: remove redundant -ve error check and return path 2016-07-25 11:17:16 -07:00
kcmsock.c kcm: fix a socket double free 2016-08-31 21:00:19 -07:00
Kconfig kcm: Kernel Connection Multiplexor module 2016-03-09 16:36:14 -05:00
Makefile kcm: Add statistics and proc interfaces 2016-03-09 16:36:14 -05:00