mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	Bluetooth: SCO: remove the redundant sco_conn_put
When adding conn, it is necessary to increase and retain the conn reference
count at the same time.
Another problem was fixed along the way, conn_put is missing when hcon is NULL
in the timeout routine.
Fixes: e6720779ae ("Bluetooth: SCO: Use kref to track lifetime of sco_conn")
Reported-and-tested-by: syzbot+489f78df4709ac2bfdd3@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=489f78df4709ac2bfdd3
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
			
			
This commit is contained in:
		
							parent
							
								
									a66dfaf18f
								
							
						
					
					
						commit
						ed95885549
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		| 
						 | 
					@ -143,6 +143,7 @@ static void sco_sock_timeout(struct work_struct *work)
 | 
				
			||||||
	sco_conn_lock(conn);
 | 
						sco_conn_lock(conn);
 | 
				
			||||||
	if (!conn->hcon) {
 | 
						if (!conn->hcon) {
 | 
				
			||||||
		sco_conn_unlock(conn);
 | 
							sco_conn_unlock(conn);
 | 
				
			||||||
 | 
							sco_conn_put(conn);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sk = sco_sock_hold(conn);
 | 
						sk = sco_sock_hold(conn);
 | 
				
			||||||
| 
						 | 
					@ -192,7 +193,6 @@ static struct sco_conn *sco_conn_add(struct hci_conn *hcon)
 | 
				
			||||||
			conn->hcon = hcon;
 | 
								conn->hcon = hcon;
 | 
				
			||||||
			sco_conn_unlock(conn);
 | 
								sco_conn_unlock(conn);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		sco_conn_put(conn);
 | 
					 | 
				
			||||||
		return conn;
 | 
							return conn;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue