From: Fabien Chevalier <fchevalier@silicom.fr>
To: Marcel Holtmann <marcel@holtmann.org>,
Johan Hedberg <johan.hedberg@nokia.com>
Cc: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [PATCH] Fix bogus avdtp error codes management
Date: Mon, 17 Sep 2007 19:41:21 +0200 [thread overview]
Message-ID: <46EEBC41.80401@silicom.fr> (raw)
[-- 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
next reply other threads:[~2007-09-17 17:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-17 17:41 Fabien Chevalier [this message]
2007-09-18 8:15 ` [PATCH] Fix bogus avdtp error codes management 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
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=46EEBC41.80401@silicom.fr \
--to=fchevalier@silicom.fr \
--cc=bluez-devel@lists.sourceforge.net \
--cc=johan.hedberg@nokia.com \
--cc=marcel@holtmann.org \
/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