Commit 8404b686 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Sasha Levin

s390/qeth: avoid null pointer dereference on OSN

[ Upstream commit 25e2c341 ]

Access card->dev only after checking whether's its valid.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
parent 89b9ca1d
...@@ -961,7 +961,6 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) ...@@ -961,7 +961,6 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
case QETH_CARD_TYPE_OSN: case QETH_CARD_TYPE_OSN:
card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN, card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN,
ether_setup); ether_setup);
card->dev->flags |= IFF_NOARP;
break; break;
default: default:
card->dev = alloc_etherdev(0); card->dev = alloc_etherdev(0);
...@@ -974,9 +973,12 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) ...@@ -974,9 +973,12 @@ static int qeth_l2_setup_netdev(struct qeth_card *card)
card->dev->watchdog_timeo = QETH_TX_TIMEOUT; card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
card->dev->mtu = card->info.initial_mtu; card->dev->mtu = card->info.initial_mtu;
card->dev->netdev_ops = &qeth_l2_netdev_ops; card->dev->netdev_ops = &qeth_l2_netdev_ops;
card->dev->ethtool_ops = if (card->info.type == QETH_CARD_TYPE_OSN) {
(card->info.type != QETH_CARD_TYPE_OSN) ? card->dev->ethtool_ops = &qeth_l2_osn_ops;
&qeth_l2_ethtool_ops : &qeth_l2_osn_ops; card->dev->flags |= IFF_NOARP;
} else {
card->dev->ethtool_ops = &qeth_l2_ethtool_ops;
}
card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; card->dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
card->info.broadcast_capable = 1; card->info.broadcast_capable = 1;
qeth_l2_request_initial_mac(card); qeth_l2_request_initial_mac(card);
......
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