mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ydroneaud@opteya.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	viro@zeniv.linux.org.uk
Subject: Re: [PATCH v2] net: handle error more gracefully in socketpair()
Date: Thu, 05 Dec 2013 16:23:33 -0500 (EST)	[thread overview]
Message-ID: <20131205.162333.1525865133149454763.davem@davemloft.net> (raw)
In-Reply-To: <1385979146-13825-1-git-send-email-ydroneaud@opteya.com>

From: Yann Droneaud <ydroneaud@opteya.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@davemloft.net>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Yann Droneaud <ydroneaud@opteya.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.

  reply	other threads:[~2013-12-05 21:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02  9:36 [PATCH] net: use a proper error path " Yann Droneaud
2013-12-02 10:12 ` [PATCH v2] net: handle error more gracefully " Yann Droneaud
2013-12-05 21:23   ` David Miller [this message]
2013-12-05 23:15     ` Yann Droneaud
2013-12-06  0:43       ` David Miller
2013-12-06 10:10         ` Yann Droneaud
2013-12-06 10:48         ` Al Viro
2013-12-06 17:14           ` David Miller
2013-12-09 21:42             ` [PATCH v3] " Yann Droneaud
2013-12-11  3:24               ` David Miller
2013-12-11  9:32                 ` Yann Droneaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131205.162333.1525865133149454763.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ydroneaud@opteya.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®