[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131210.222429.1538443980618684288.davem@davemloft.net>
Date: Tue, 10 Dec 2013 22:24:29 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: ydroneaud@...eya.com
Cc: viro@...IV.linux.org.uk, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] net: handle error more gracefully in socketpair()
From: Yann Droneaud <ydroneaud@...eya.com>
Date: Mon, 9 Dec 2013 22:42:20 +0100
> This patch makes socketpair() use error paths which do not
> rely on heavy-weight call to sys_close(): it's better to try
> to push the file descriptor to userspace before installing
> the socket file to the file descriptor, so that errors are
> catched earlier and being easier to handle.
>
> Using sys_close() seems to be the exception, while writing the
> file descriptor before installing it look like it's more or less
> the norm: eg. except for code used in init/, error handling
> involve fput() and put_unused_fd(), but not sys_close().
>
> This make socketpair() usage of sys_close() quite unusual.
> So it deserves to be replaced by the common pattern relying on
> fput() and put_unused_fd() just like, for example, the one used
> in pipe(2) or recvmsg(2).
>
> Three distinct error paths are still needed since calling
> fput() on file structure returned by sock_alloc_file() will
> implicitly call sock_release() on the associated socket
> structure.
>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Al Viro <viro@...iv.linux.org.uk>
> Signed-off-by: Yann Droneaud <ydroneaud@...eya.com>
> Link: http://marc.info/?i=1385979146-13825-1-git-send-email-ydroneaud@opteya.com
Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists