All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix bogus avdtp error codes management
@ 2007-09-17 17:41 Fabien Chevalier
  2007-09-18  8:15 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Fabien Chevalier @ 2007-09-17 17:41 UTC (permalink / raw)
  To: Marcel Holtmann, Johan Hedberg; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

Hi Johan & Marcel,

While trying to fix this cross case issue, i came with an issue with the 
way error codes are handled
in avdtp.c.
The issue is basically that the part of the code that retrieves the 
exact error value is never executed
due to premature return.

Please have a look at the current patch.

Fabien

[-- Attachment #2: avdtp-bogus-error-checking.patch --]
[-- Type: text/x-patch, Size: 1422 bytes --]

diff -u -1 -0 -r1.49 avdtp.c
--- avdtp.c     2 Sep 2007 16:52:50 -0000       1.49
+++ avdtp.c     17 Sep 2007 17:33:24 -0000
@@ -1501,38 +1501,38 @@
        if (cond & G_IO_NVAL)
                return FALSE;
 
        if (!g_slist_find(sessions, session)) {
                debug("l2cap_connect_cb: session got removed");
                return FALSE;
        }
 
        sk = g_io_channel_unix_get_fd(chan);
 
-       if (cond & (G_IO_ERR | G_IO_HUP)) {
-               err = EIO;
-               goto failed;
-       }
-
        len = sizeof(ret);
        if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &len) < 0) {
                err = errno;
                error("getsockopt(SO_ERROR): %s (%d)", strerror(err), err);
                goto failed;
        }
 
        if (ret != 0) {
                err = ret;
                error("connect(): %s (%d)", strerror(err), err);
                goto failed;
        }
 
+       if (cond & G_IO_HUP) {
+               err = EIO;
+               goto failed;
+       }
+
        ba2str(&session->dst, address);
        debug("AVDTP: connected %s channel to %s",
                        session->pending_open ? "transport" : "signaling",
                        address);
 
        memset(&l2o, 0, sizeof(l2o));
        len = sizeof(l2o);
        if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &l2o,
                                &len) < 0) {
                err = errno;
f

[-- Attachment #3: fchevalier.vcf --]
[-- Type: text/x-vcard, Size: 253 bytes --]

begin:vcard
fn:Fabien CHEVALIER
n:CHEVALIER;Fabien
org:SILICOM
adr:;;4 rue de Jouanet; RENNES ATALANTE;;35700;FRANCE
email;internet:fchevalier@silicom.fr
title:Software & Studies Engineer
tel;work:+33 (0) 2 99 84 17 17
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-09-18 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-17 17:41 [PATCH] Fix bogus avdtp error codes management Fabien Chevalier
2007-09-18  8:15 ` Johan Hedberg
2007-09-18  8:27   ` [Bluez-devel] " Marcel Holtmann
2007-09-18  8:57     ` Fabien Chevalier
2007-09-18  9:09       ` Johan Hedberg
2007-09-18 12:00         ` [Bluez-devel] " Fabien Chevalier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.