lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 21 Oct 2020 01:07:12 -0500
From:   Lijun Pan <ljp@...ux.ibm.com>
To:     netdev@...r.kernel.org
Cc:     Lijun Pan <ljp@...ux.ibm.com>, Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net v2] ibmvnic: fix ibmvnic_set_mac

Jakub Kicinski brought up a concern in ibmvnic_set_mac().
ibmvnic_set_mac() does this:

	ether_addr_copy(adapter->mac_addr, addr->sa_data);
	if (adapter->state != VNIC_PROBED)
		rc = __ibmvnic_set_mac(netdev, addr->sa_data);

So if state == VNIC_PROBED, the user can assign an invalid address to
adapter->mac_addr, and ibmvnic_set_mac() will still return 0.

The fix is to add the handling for "adapter->state == VNIC_PROBED" case,
which saves the old mac address back to adapter->mac_addr, and
returns an error code.

Fixes: 62740e97881c ("net/ibmvnic: Update MAC address settings after adapter reset")
Cc: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Lijun Pan <ljp@...ux.ibm.com>
---
v2: change the subject from v1's 
    "ibmvnic: no need to update adapter->mac_addr before it completes"
    handle adapter->state==VNIC_PROBED case in else statement.

 drivers/net/ethernet/ibm/ibmvnic.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 4dd3625a4fbc..0d78e1e3d44c 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1829,8 +1829,12 @@ static int ibmvnic_set_mac(struct net_device *netdev, void *p)
 
 	rc = 0;
 	ether_addr_copy(adapter->mac_addr, addr->sa_data);
-	if (adapter->state != VNIC_PROBED)
+	if (adapter->state != VNIC_PROBED) {
 		rc = __ibmvnic_set_mac(netdev, addr->sa_data);
+	} else {
+		ether_addr_copy(adapter->mac_addr, netdev->dev_addr);
+		rc = -EIO;
+	}
 
 	return rc;
 }
-- 
2.23.0

Powered by blists - more mailing lists