[ovs-dev] [PATCH] socket-util: Report fd of -1 on error in inet_open_active().
Ethan Jackson
jacksone at nicira.com
Wed Nov 7 20:53:59 UTC 2012
Acked-by: Ethan Jackson <ethan at nicira.com>
On Wed, Nov 7, 2012 at 11:47 AM, Ben Pfaff <bpfaff at nicira.com> wrote:
> inet_open_active() is documented to report a fd of -1 when an error occurs.
> All three of its callers rely on this, by checking only the fd to determine
> whether there was an error. This means that if the call to
> set_nonblocking() or set_dscp() or connect() failed, then the callers would
> try to use a fd that had already been closed, wreaking havoc.
>
> This fixes a bug introduced in commit a4efa3fc5d (socket-util: Close socket
> on failed dscp modification.)
>
> Bug #13750.
> Reported-by: Scott Hendricks <shendricks at vmware.com>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
> lib/socket-util.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/lib/socket-util.c b/lib/socket-util.c
> index a37dfe4..4edf956 100644
> --- a/lib/socket-util.c
> +++ b/lib/socket-util.c
> @@ -612,6 +612,7 @@ exit:
> }
> } else if (fd >= 0) {
> close(fd);
> + fd = -1;
> }
> *fdp = fd;
> return error;
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20121107/553f6e03/attachment-0003.html>
More information about the dev
mailing list