From 13bf829581c7d7dadb5b531caa4de681ab03cbc1 Mon Sep 17 00:00:00 2001 From: Julian Wiedmann Date: Thu, 27 Feb 2020 18:08:11 +0100 Subject: [PATCH] s390/qeth: validate device-provided MAC address It's good practice to not blindly trust what the HW offers. Signed-off-by: Julian Wiedmann Reviewed-by: Alexandra Winter Signed-off-by: David S. Miller --- drivers/s390/net/qeth_l3_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 667a10d6495d..1000e18c1090 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -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);