aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/bluetooth/hidp/core.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 07348e142f16..926a0e8b7136 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -70,10 +70,11 @@ static void hidp_session_terminate(struct hidp_session *s);
70 70
71static void hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci) 71static void hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci)
72{ 72{
73 u32 valid_flags = 0;
73 memset(ci, 0, sizeof(*ci)); 74 memset(ci, 0, sizeof(*ci));
74 bacpy(&ci->bdaddr, &session->bdaddr); 75 bacpy(&ci->bdaddr, &session->bdaddr);
75 76
76 ci->flags = session->flags; 77 ci->flags = session->flags & valid_flags;
77 ci->state = BT_CONNECTED; 78 ci->state = BT_CONNECTED;
78 79
79 if (session->input) { 80 if (session->input) {
@@ -1312,6 +1313,7 @@ int hidp_connection_add(struct hidp_connadd_req *req,
1312 struct socket *ctrl_sock, 1313 struct socket *ctrl_sock,
1313 struct socket *intr_sock) 1314 struct socket *intr_sock)
1314{ 1315{
1316 u32 valid_flags = 0;
1315 struct hidp_session *session; 1317 struct hidp_session *session;
1316 struct l2cap_conn *conn; 1318 struct l2cap_conn *conn;
1317 struct l2cap_chan *chan; 1319 struct l2cap_chan *chan;
@@ -1321,6 +1323,9 @@ int hidp_connection_add(struct hidp_connadd_req *req,
1321 if (ret) 1323 if (ret)
1322 return ret; 1324 return ret;
1323 1325
1326 if (req->flags & ~valid_flags)
1327 return -EINVAL;
1328
1324 chan = l2cap_pi(ctrl_sock->sk)->chan; 1329 chan = l2cap_pi(ctrl_sock->sk)->chan;
1325 conn = NULL; 1330 conn = NULL;
1326 l2cap_chan_lock(chan); 1331 l2cap_chan_lock(chan);
@@ -1351,8 +1356,12 @@ out_conn:
1351 1356
1352int hidp_connection_del(struct hidp_conndel_req *req) 1357int hidp_connection_del(struct hidp_conndel_req *req)
1353{ 1358{
1359 u32 valid_flags = BIT(HIDP_VIRTUAL_CABLE_UNPLUG);
1354 struct hidp_session *session; 1360 struct hidp_session *session;
1355 1361
1362 if (req->flags & ~valid_flags)
1363 return -EINVAL;
1364
1356 session = hidp_session_find(&req->bdaddr); 1365 session = hidp_session_find(&req->bdaddr);
1357 if (!session) 1366 if (!session)
1358 return -ENOENT; 1367 return -ENOENT;