s390/qeth: validate device-provided MAC address
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 27 Feb 2020 17:08:11 +0000 (18:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Feb 2020 19:15:12 +0000 (11:15 -0800)
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>
drivers/s390/net/qeth_l3_main.c

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