From: Johan Hedberg Date: Wed, 19 Jan 2011 06:36:49 +0000 (+0530) Subject: Bluetooth: Fix MITM protection requirement preservation X-Git-Tag: v2.6.38-rc3~29^2~4^2~10 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=65cf686ee102b7eb0477a4bab82ff227071a0258;p=~emulex%2Finfiniband.git Bluetooth: Fix MITM protection requirement preservation If an existing connection has a MITM protection requirement (the first bit of the auth_type) then that requirement should not be cleared by new sockets that reuse the ACL but don't have that requirement. Signed-off-by: Johan Hedberg Acked-by: Marcel Holtmann Signed-off-by: Gustavo F. Padovan --- diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 65a3fb5678e..fe712a89a85 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -442,6 +442,9 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type) else if (conn->link_mode & HCI_LM_AUTH) return 1; + /* Make sure we preserve an existing MITM requirement*/ + auth_type |= (conn->auth_type & 0x01); + conn->auth_type = auth_type; if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {