From: Dan Carpenter <dan.carpenter@oracle.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
"open list:BLUETOOTH SUBSYSTEM" <linux-bluetooth@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: [patch] Bluetooth: check for (harmless) underflow
Date: Thu, 30 May 2013 08:05:10 +0000 [thread overview]
Message-ID: <20130530080510.GD8148@debian> (raw)
"len" can be negative here. It's harmless but pretty subtle and
scary looking so lets add a check for it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a1b7a02..438f39e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4069,6 +4069,9 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
BT_DBG("scid 0x%4.4x flags 0x%2.2x result 0x%2.2x len %d", scid, flags,
result, len);
+ if (len < 0)
+ return -EINVAL;
+
chan = l2cap_get_chan_by_scid(conn, scid);
if (!chan)
return 0;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
"open list:BLUETOOTH SUBSYSTEM" <linux-bluetooth@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: [patch] Bluetooth: check for (harmless) underflow
Date: Thu, 30 May 2013 11:05:10 +0300 [thread overview]
Message-ID: <20130530080510.GD8148@debian> (raw)
"len" can be negative here. It's harmless but pretty subtle and
scary looking so lets add a check for it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index a1b7a02..438f39e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4069,6 +4069,9 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
BT_DBG("scid 0x%4.4x flags 0x%2.2x result 0x%2.2x len %d", scid, flags,
result, len);
+ if (len < 0)
+ return -EINVAL;
+
chan = l2cap_get_chan_by_scid(conn, scid);
if (!chan)
return 0;
next reply other threads:[~2013-05-30 8:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 8:05 Dan Carpenter [this message]
2013-05-30 8:05 ` [patch] Bluetooth: check for (harmless) underflow Dan Carpenter
2013-05-31 0:02 ` Gustavo Padovan
2013-05-31 0:02 ` Gustavo Padovan
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=20130530080510.GD8148@debian \
--to=dan.carpenter@oracle.com \
--cc=gustavo@padovan.org \
--cc=johan.hedberg@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--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 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.