Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1310590
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Kamal Mostafa <kamal@canonical.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.2.y-ckt 281/305] net: phy: mdio-mux: Check return value of mdiobus_alloc() |
| Date | Sat, 16 Jan 2016 01:20:02 +0100 |
| Message-ID | <qRmL0-54G-9@gated-at.bofh.it> (permalink) |
| References | <qRmBj-507-3@gated-at.bofh.it> |
| X-Mailer | git-send-email 1.9.1 |
| X-Extended-Stable | 4.2 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 42 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Tobias Klauser <tklauser@distanz.ch>, "David S. Miller" <davem@davemloft.net>, Kamal Mostafa <kamal@canonical.com> |
| X-Original-Date | Fri, 15 Jan 2016 16:01:35 -0800 |
| X-Original-Message-ID | <1452902519-2754-282-git-send-email-kamal@canonical.com> |
| X-Original-References | <1452902519-2754-1-git-send-email-kamal@canonical.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1310590 |
Show key headers only | View raw
4.2.8-ckt2 -stable review patch. If anyone has any objections, please let me know.
---8<------------------------------------------------------------
From: Tobias Klauser <tklauser@distanz.ch>
commit 20b08e1a793d898f0f13040d5418ee0955f678cf upstream.
mdiobus_alloc() might return NULL, but its return value is not
checked in mdio_mux_init(). This could potentially lead to a NULL
pointer dereference. Fix it by checking the return value
Fixes: 0ca2997d1452 ("netdev/of/phy: Add MDIO bus multiplexer support.")
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
drivers/net/phy/mdio-mux.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c
index 4d4d25e..ac8a823 100644
--- a/drivers/net/phy/mdio-mux.c
+++ b/drivers/net/phy/mdio-mux.c
@@ -148,9 +148,14 @@ int mdio_mux_init(struct device *dev,
}
cb->bus_number = v;
cb->parent = pb;
+
cb->mii_bus = mdiobus_alloc();
+ if (!cb->mii_bus) {
+ ret_val = -ENOMEM;
+ of_node_put(child_bus_node);
+ break;
+ }
cb->mii_bus->priv = cb;
-
cb->mii_bus->irq = cb->phy_irq;
cb->mii_bus->name = "mdio_mux";
snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%x.%x",
--
1.9.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 4.2.y-ckt 281/305] net: phy: mdio-mux: Check return value of mdiobus_alloc() Kamal Mostafa <kamal@canonical.com> - 2016-01-16 01:20 +0100
csiph-web