Skip to content

Commit

Permalink
Bluetooth: Add missing cmd_status() in mgmt
Browse files Browse the repository at this point in the history
Improve error handling in mgmt load_keys()

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Gustavo F. Padovan committed Oct 14, 2011
1 parent 56b7d13 commit b705913
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,15 @@ static int load_keys(struct sock *sk, u16 index, unsigned char *data, u16 len)
cp = (void *) data;

if (len < sizeof(*cp))
return -EINVAL;
return cmd_status(sk, index, MGMT_OP_LOAD_KEYS, EINVAL);

key_count = get_unaligned_le16(&cp->key_count);

expected_len = sizeof(*cp) + key_count * sizeof(struct mgmt_key_info);
if (expected_len != len) {
BT_ERR("load_keys: expected %u bytes, got %u bytes",
len, expected_len);
return -EINVAL;
return cmd_status(sk, index, MGMT_OP_LOAD_KEYS, EINVAL);
}

hdev = hci_dev_get(index);
Expand Down

0 comments on commit b705913

Please sign in to comment.