svn commit: r292660 - head/sys/netgraph/bluetooth/socket
Maksim Yevmenkin
emax at FreeBSD.org
Wed Dec 23 16:32:05 UTC 2015
Author: emax
Date: Wed Dec 23 16:32:04 2015
New Revision: 292660
URL: https://svnweb.freebsd.org/changeset/base/292660
Log:
- grab ng_btsocket_l2cap_sockets_mtx lock in
ng_btsocket_l2cap_process_l2ca_enc_change()
before calling ng_btsocket_l2cap_pcb_by_cid();
- handle possible NULL value returned from
ng_btsocket_l2cap_pcb_by_cid();
Submitted by: Hans Petter Selasky; hps at selasky dot org
MFC after: 1 week
Modified:
head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
==============================================================================
--- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Wed Dec 23 15:22:44 2015 (r292659)
+++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Wed Dec 23 16:32:04 2015 (r292660)
@@ -708,8 +708,15 @@ static int ng_btsocket_l2cap_process_l2c
op = (ng_l2cap_l2ca_enc_chg_op *)(msg->data);
+ mtx_lock(&ng_btsocket_l2cap_sockets_mtx);
+
pcb = ng_btsocket_l2cap_pcb_by_cid(&rt->src, op->lcid,
op->idtype);
+ if (pcb == NULL) {
+ mtx_unlock(&ng_btsocket_l2cap_sockets_mtx);
+ return (ENOENT);
+ }
+
mtx_lock(&pcb->pcb_mtx);
pcb->encryption = op->result;
@@ -729,6 +736,7 @@ static int ng_btsocket_l2cap_process_l2c
}
}
mtx_unlock(&pcb->pcb_mtx);
+ mtx_unlock(&ng_btsocket_l2cap_sockets_mtx);
return 0;
}
More information about the svn-src-head
mailing list