linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Bluetooth: check for (harmless) underflow
@ 2013-05-30  8:05 Dan Carpenter
  2013-05-31  0:02 ` Gustavo Padovan
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-05-30  8:05 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Gustavo Padovan, Johan Hedberg, open list:BLUETOOTH SUBSYSTEM,
	kernel-janitors

"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;

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

end of thread, other threads:[~2013-05-31  0:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30  8:05 [patch] Bluetooth: check for (harmless) underflow Dan Carpenter
2013-05-31  0:02 ` Gustavo Padovan

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).