···42214221 hci_proto_connect_cfm(conn, ev->status);4222422242234223 params = hci_conn_params_lookup(hdev, &conn->dst, conn->dst_type);42244224- if (params)42244224+ if (params) {42254225 list_del_init(¶ms->action);42264226+ if (params->conn) {42274227+ hci_conn_drop(params->conn);42284228+ params->conn = NULL;42294229+ }42304230+ }4226423142274232unlock:42284233 hci_update_background_scan(hdev);···4309430443104305 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW,43114306 HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER);43124312- if (!IS_ERR(conn))43074307+ if (!IS_ERR(conn)) {43084308+ /* Store the pointer since we don't really have any43094309+ * other owner of the object besides the params that43104310+ * triggered it. This way we can abort the connection if43114311+ * the parameters get removed and keep the reference43124312+ * count consistent once the connection is established.43134313+ */43144314+ params->conn = conn;43134315 return;43164316+ }4314431743154318 switch (PTR_ERR(conn)) {43164319 case -EBUSY: