s390/qeth: validate device-provided MAC address

It's good practice to not blindly trust what the HW offers.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Julian Wiedmann 2020-02-27 18:08:11 +01:00 committed by David S. Miller
parent 9c6dc7af85
commit 13bf829581
1 changed files with 2 additions and 0 deletions

View File

@ -920,6 +920,8 @@ static int qeth_l3_iqd_read_initial_mac_cb(struct qeth_card *card,
if (cmd->hdr.return_code) if (cmd->hdr.return_code)
return -EIO; return -EIO;
if (!is_valid_ether_addr(cmd->data.create_destroy_addr.mac_addr))
return -EADDRNOTAVAIL;
ether_addr_copy(card->dev->dev_addr, ether_addr_copy(card->dev->dev_addr,
cmd->data.create_destroy_addr.mac_addr); cmd->data.create_destroy_addr.mac_addr);