Bluetooth: Fix incorrect clearing of SMP_FLAG_INITIATOR
When the SMP context is created all flags default to zero. To determine that we are the initiators it's therefore best to simply change the flag value when we know we're sending the first SMP PDU. Clearing the flag when receiving a Pairing Request is not correct since the request may be a response to a previous Security Request from us (for which we would already have correctly set the flag). Same goes for receiving a Security Request which may be coming after us already starting pairing by sending a Pairing Request. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
		
					parent
					
						
							
								e247605a62
							
						
					
				
			
			
				commit
				
					
						c072d546c2
					
				
			
		
					 1 changed files with 0 additions and 4 deletions
				
			
		| 
						 | 
					@ -735,8 +735,6 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return SMP_UNSPECIFIED;
 | 
							return SMP_UNSPECIFIED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clear_bit(SMP_FLAG_INITIATOR, &smp->flags);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -927,8 +925,6 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);
 | 
						smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clear_bit(SMP_FLAG_INITIATOR, &smp->flags);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue