Diff between 45b61a10bd0af9b0b13f508166369eb1138ae448 and ac1f8dd88a46da193b9226724a3ac60a0876598a

Changed Files

File Additions Deletions Status
src/shared/att.c +5 -1 modified

Full Patch

diff --git a/src/shared/att.c b/src/shared/att.c
index dabbdb4..8657cb6 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -727,7 +727,11 @@ static bool bt_att_chan_set_security(struct bt_att_chan *chan, int level)
 {
 	struct bt_security sec;
 
-	if (level == bt_att_chan_get_security(chan))
+	/* Check if security level has already been set, if the security level
+	 * is higher it shall satisfy the request since we never want to
+	 * downgrade security.
+	 */
+	if (level <= bt_att_chan_get_security(chan))
 		return true;
 
 	if (chan->type == BT_ATT_LOCAL) {