Bluetooth: ATT: Check ATT payload len against MTU
During allocation ATT pdu buffer there's possibility to precheck whether length of such buffer doesn't exceeds ATT MTU. Change-Id: I7f729e4d7f7474d7f33e417ea61a00ceeb7426c5 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
66cf2511f1
commit
9bf8ad20df
1 changed files with 6 additions and 0 deletions
|
@ -1311,6 +1311,12 @@ struct bt_buf *bt_att_create_pdu(struct bt_conn *conn, uint8_t op, size_t len)
|
|||
{
|
||||
struct bt_att_hdr *hdr;
|
||||
struct bt_buf *buf;
|
||||
struct bt_att *att = conn->att;
|
||||
|
||||
if (len + sizeof(op) > att->mtu) {
|
||||
BT_WARN("ATT MTU exceeded, max %u, wanted %u\n", att->mtu, len);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = bt_l2cap_create_pdu(conn);
|
||||
if (!buf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue