Skip to content

Commit

Permalink
Bluetooth: hidp_connection_add() unsafe use of l2cap_pi()
Browse files Browse the repository at this point in the history
it's OK after we'd verified the sockets, but not before that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Al Viro authored and Marcel Holtmann committed Dec 19, 2014
1 parent 004fa5e commit 51bda2b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/bluetooth/hidp/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1314,13 +1314,14 @@ int hidp_connection_add(struct hidp_connadd_req *req,
{
struct hidp_session *session;
struct l2cap_conn *conn;
struct l2cap_chan *chan = l2cap_pi(ctrl_sock->sk)->chan;
struct l2cap_chan *chan;
int ret;

ret = hidp_verify_sockets(ctrl_sock, intr_sock);
if (ret)
return ret;

chan = l2cap_pi(ctrl_sock->sk)->chan;
conn = NULL;
l2cap_chan_lock(chan);
if (chan->conn)
Expand Down

0 comments on commit 51bda2b

Please sign in to comment.