linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: kernel@pengutronix.de, Alexander Aring <alex.aring@gmail.com>,
	Jukka Rissanen <jukka.rissanen@linux.intel.com>
Subject: [RFC bluetooth-next 1/2] bluetooth: 6lowpan: avoid endless loop
Date: Sat, 24 Oct 2015 16:50:55 +0200	[thread overview]
Message-ID: <1445698256-10407-2-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1445698256-10407-1-git-send-email-alex.aring@gmail.com>

When -EAGAIN as return value for receive handling will do a retry of
parsing I can trigger a endless loop when iphc decompression e.g.
returns an errno because some missing function "-ENOTSUPP" or something
else. Somebody from outside can trigger an endless loop when sending a
an IPHC header which triggers this behaviour.

NOTE: This really depends only if -EAGAIN means "try again to call the
receive handler with the skb". Sometimes we also drop (and kfree) the
skb, I think something is broken there... depends on the error branch.
When receiving failed simple free skb and return errno (which is not
-EAGAIN).

Cc: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/bluetooth/6lowpan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index d85af23..d936e7d 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -383,10 +383,8 @@ static int chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
 		return -ENOENT;
 
 	err = recv_pkt(skb, dev->netdev, chan);
-	if (err) {
+	if (err)
 		BT_DBG("recv pkt %d", err);
-		err = -EAGAIN;
-	}
 
 	return err;
 }
-- 
2.6.1


  reply	other threads:[~2015-10-24 14:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24 14:50 [RFC bluetooth-next 0/2] bluetooth: 6lowpan: suggestions for Jukka Alexander Aring
2015-10-24 14:50 ` Alexander Aring [this message]
2015-10-25 20:11   ` [RFC bluetooth-next 1/2] bluetooth: 6lowpan: avoid endless loop Marcel Holtmann
2015-10-25 20:27     ` Alexander Aring
2015-10-27  9:21       ` Jukka Rissanen
2015-10-24 14:50 ` [RFC bluetooth-next 2/2] bluetooth: 6lowpan: rework receive handling Alexander Aring
2015-10-28  8:57   ` Jukka Rissanen

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=1445698256-10407-2-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=jukka.rissanen@linux.intel.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-bluetooth@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).