From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3AEB1C687; Mon, 4 Mar 2024 21:34:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709588050; cv=none; b=Zxp8be+oDP+Nxw21HFip78vYr03Gx2RTiDdF1EA/G0aDIsTMXxHq6T5eeIOrEL6kb2hO0AjzPjl3G6vE7P/dwUwtD5118WKjyj5x46v5GgH1XDvW6NDfOiBvjRddzunopW5KMPm7D9YQZynvbb6vz/TMmH6ZCCQCwNhCjAQCZcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709588050; c=relaxed/simple; bh=2+1IU1yTVIr3XQYdTySN9M5Mx/4IVb6Libis0L3xuA4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WWKaheIJTKxtTIbxaYaBKTF5vcsmOPUpVr+dCe8lMNH6K4KG6lWnV425Ns6XPwXpUkMgvdJdcpIyR0OyGDnYAJWNcWdw2enLnLvXaXb+QfbqxN4INxRrAXzOUshRQ/ZxONwTSeA/ThsZNUFMiK1MHrSMYnLcLb29ut+S9BIGPYs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yjL2HX5c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yjL2HX5c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86DBAC433C7; Mon, 4 Mar 2024 21:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709588049; bh=2+1IU1yTVIr3XQYdTySN9M5Mx/4IVb6Libis0L3xuA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yjL2HX5cYXM5kLt5MHoRD9Yj+1CXwVPgEu0jvuT/mNYmN98pbuinvmgFCXgSpDWjT 6uKZKN+j8Y/oUCWyethqg7B6UCdC1T9TSuPrX0gZE5XClAiB1mmEWnt8hrZKPQncLI 1MieCio+c/OmsVxMrTsLL7/+NiZGD3yDRpIvUUAE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Javier Carrasco , Simon Horman , Peter Korsgaard , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.4 06/25] net: usb: dm9601: fix wrong return value in dm9601_mdio_read Date: Mon, 4 Mar 2024 21:23:42 +0000 Message-ID: <20240304211535.957577985@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240304211535.741936181@linuxfoundation.org> References: <20240304211535.741936181@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Javier Carrasco [ Upstream commit c68b2c9eba38ec3f60f4894b189090febf4d8d22 ] The MII code does not check the return value of mdio_read (among others), and therefore no error code should be sent. A previous fix to the use of an uninitialized variable propagates negative error codes, that might lead to wrong operations by the MII library. An example of such issues is the use of mii_nway_restart by the dm9601 driver. The mii_nway_restart function does not check the value returned by mdio_read, which in this case might be a negative number which could contain the exact bit the function checks (BMCR_ANENABLE = 0x1000). Return zero in case of error, as it is common practice in users of mdio_read to avoid wrong uses of the return value. Fixes: 8f8abb863fa5 ("net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read") Signed-off-by: Javier Carrasco Reviewed-by: Simon Horman Reviewed-by: Peter Korsgaard Link: https://lore.kernel.org/r/20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/usb/dm9601.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 5aad26600b03e..9b7db5fd9e08f 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c @@ -231,7 +231,7 @@ static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc) err = dm_read_shared_word(dev, 1, loc, &res); if (err < 0) { netdev_err(dev->net, "MDIO read error: %d\n", err); - return err; + return 0; } netdev_dbg(dev->net, -- 2.43.0