提交 277ffbe3 编写于 作者: G Gustavo F. Padovan 提交者: Marcel Holtmann

Bluetooth: Check the minimum {I,S}-frame size into L2CAP

All packets with size fewer than the minimum specified is dropped.
Note that the size of the l2cap basic header, FCS and SAR fields are
already subtracted of len at the moment of the size check.
Signed-off-by: NGustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: NJoão Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 1d8f5d16
...@@ -3627,10 +3627,17 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk ...@@ -3627,10 +3627,17 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
if (l2cap_check_fcs(pi, skb)) if (l2cap_check_fcs(pi, skb))
goto drop; goto drop;
if (__is_iframe(control)) if (__is_iframe(control)) {
if (len < 4)
goto drop;
l2cap_data_channel_iframe(sk, control, skb); l2cap_data_channel_iframe(sk, control, skb);
else } else {
if (len != 0)
goto drop;
l2cap_data_channel_sframe(sk, control, skb); l2cap_data_channel_sframe(sk, control, skb);
}
goto done; goto done;
...@@ -3645,7 +3652,8 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk ...@@ -3645,7 +3652,8 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
if (pi->fcs == L2CAP_FCS_CRC16) if (pi->fcs == L2CAP_FCS_CRC16)
len -= 2; len -= 2;
if (len > L2CAP_DEFAULT_MAX_PDU_SIZE || __is_sframe(control)) if (len > L2CAP_DEFAULT_MAX_PDU_SIZE || len < 4
|| __is_sframe(control))
goto drop; goto drop;
if (l2cap_check_fcs(pi, skb)) if (l2cap_check_fcs(pi, skb))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册