[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20131205.162333.1525865133149454763.davem@davemloft.net>
Date: Thu, 05 Dec 2013 16:23:33 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: ydroneaud@...eya.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
viro@...iv.linux.org.uk
Subject: Re: [PATCH v2] net: handle error more gracefully in socketpair()
From: Yann Droneaud <ydroneaud@...eya.com>
Date: Mon, 2 Dec 2013 11:12:26 +0100
> socketpair() error paths can be simplified to not call
> heavy-weight sys_close().
>
> This patch makes socketpair() use of error paths which do not
> rely on heavy-weight call to sys_lose(): 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.
>
> Three distinct error paths are 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=1385977019-12282-1-git-send-email-ydroneaud@opteya.com
I know that sys_close() is expensive, _but_ erroring out on
the put_user() is extremely rare and logically it makes
a ton more sense to fully install a file descriptor before
writing it's numeric value into userspace.
Sorry, I think the current code is fine and I'm not going
to apply this, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists