fix kcm_clone()
authorAl Viro <viro@ZenIV.linux.org.uk>
Tue, 5 Dec 2017 23:27:57 +0000 (23:27 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Dec 2017 15:25:47 +0000 (16:25 +0100)
commit80c0f4777fd6d092537790903800dd352e5d89e5
tree1e0d8c98152d9186ddf308ceda698975c7799796
parent16648cbcd3326d3abaa3e4239dfda9c7b39e644f
fix kcm_clone()

commit a5739435b5a3b8c449f8844ecd71a3b1e89f0a33 upstream.

1) it's fput() or sock_release(), not both
2) don't do fd_install() until the last failure exit.
3) not a bug per se, but... don't attach socket to struct file
   until it's set up.

Take reserving descriptor into the caller, move fd_install() to the
caller, sanitize failure exits and calling conventions.

Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/kcm/kcmsock.c