make sock_alloc_file() do sock_release() on failures
This changes calling conventions (and simplifies the hell out the callers). New rules: once struct socket had been passed to sock_alloc_file(), it's been consumed either by struct file or by sock_release() done by sock_alloc_file(). Either way the caller should not do sock_release() after that point. Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -5080,7 +5080,6 @@ static int sctp_getsockopt_peeloff_common(struct sock *sk, sctp_peeloff_arg_t *p
|
||||
*newfile = sock_alloc_file(newsock, 0, NULL);
|
||||
if (IS_ERR(*newfile)) {
|
||||
put_unused_fd(retval);
|
||||
sock_release(newsock);
|
||||
retval = PTR_ERR(*newfile);
|
||||
*newfile = NULL;
|
||||
return retval;
|
||||
|
||||
Reference in New Issue
Block a user