diff mbox series

bluetooth: If unknown option in L2CAP Configuration Request is a hint, Bluetooth stack responds with "Command Reject" instead of "Configuration Response"

Message ID 3020b8d0c7d39428aec573153b3c3414213be7ce.camel@peiker-cee.de
State New
Headers show
Series bluetooth: If unknown option in L2CAP Configuration Request is a hint, Bluetooth stack responds with "Command Reject" instead of "Configuration Response" | expand

Commit Message

Konstantin Forostyan Jan. 28, 2020, 1:27 p.m. UTC
Hello community,

It seems that there's a bug in Bluetooth stack of 4.20 kernel. I
discovered it during Bluetooth qualification tests. L2CAP/COS/CFD/BV-
12-C [Unknown Option Response] test fails because instead of
"Configuration Response" with error code 0x0003 "unknown option" the
Bluetooth stack generates "Command Reject".

I think, this happens because the tester (Bluetooth SIG PTS) uses hints
as unknown options, and the Bluetooth stack has special handling for
hints. 

I made a small patch in order to overcome this problem. Please confirm,
that the patch is feasible. If not, please suggest how to fix the
"Command Reject" problem.

Thank you and best regards,
Konstantin
diff mbox series

Patch

--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3381,11 +3381,11 @@ 
 			break;
 
 		default:
-			if (hint)
-				break;
-
 			result = L2CAP_CONF_UNKNOWN;
-			*((u8 *) ptr++) = type;
+
+			if (!hint)
+			    *((u8 *) ptr++) = type;
+
 			break;
 		}
 	}