Commit 1740c29a authored by xypron.glpk@gmx.de's avatar xypron.glpk@gmx.de Committed by David S. Miller

net: ehea: avoid null pointer dereference

ehea_get_port may return NULL. Do not dereference NULL value.

Fixes: 8c4877a4 ("ehea: Use the standard logging functions")
Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Acked-by: default avatarThadeu Lima de Souza Cascardo <cascardo@debian.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 099a728d
...@@ -1169,16 +1169,15 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe) ...@@ -1169,16 +1169,15 @@ static void ehea_parse_eqe(struct ehea_adapter *adapter, u64 eqe)
ec = EHEA_BMASK_GET(NEQE_EVENT_CODE, eqe); ec = EHEA_BMASK_GET(NEQE_EVENT_CODE, eqe);
portnum = EHEA_BMASK_GET(NEQE_PORTNUM, eqe); portnum = EHEA_BMASK_GET(NEQE_PORTNUM, eqe);
port = ehea_get_port(adapter, portnum); port = ehea_get_port(adapter, portnum);
if (!port) {
netdev_err(NULL, "unknown portnum %x\n", portnum);
return;
}
dev = port->netdev; dev = port->netdev;
switch (ec) { switch (ec) {
case EHEA_EC_PORTSTATE_CHG: /* port state change */ case EHEA_EC_PORTSTATE_CHG: /* port state change */
if (!port) {
netdev_err(dev, "unknown portnum %x\n", portnum);
break;
}
if (EHEA_BMASK_GET(NEQE_PORT_UP, eqe)) { if (EHEA_BMASK_GET(NEQE_PORT_UP, eqe)) {
if (!netif_carrier_ok(dev)) { if (!netif_carrier_ok(dev)) {
ret = ehea_sense_port_attr(port); ret = ehea_sense_port_attr(port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment