Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1657720

[PATCH 3.18 06/33] s390/qeth: avoid null pointer dereference on OSN

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 3.18 06/33] s390/qeth: avoid null pointer dereference on OSN
Date 2017-06-05 18:20 +0200
Message-ID <tP2Ty-59z-67@gated-at.bofh.it> (permalink)
References <tP2Tw-59z-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Julian Wiedmann <jwi@linux.vnet.ibm.com>


[ Upstream commit 25e2c341e7818a394da9abc403716278ee646014 ]

Access card->dev only after checking whether's its valid.

Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/s390/net/qeth_l2_main.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -970,7 +970,6 @@ static int qeth_l2_setup_netdev(struct q
 	case QETH_CARD_TYPE_OSN:
 		card->dev = alloc_netdev(0, "osn%d", NET_NAME_UNKNOWN,
 					 ether_setup);
-		card->dev->flags |= IFF_NOARP;
 		break;
 	default:
 		card->dev = alloc_etherdev(0);
@@ -983,9 +982,12 @@ static int qeth_l2_setup_netdev(struct q
 	card->dev->watchdog_timeo = QETH_TX_TIMEOUT;
 	card->dev->mtu = card->info.initial_mtu;
 	card->dev->netdev_ops = &qeth_l2_netdev_ops;
-	card->dev->ethtool_ops =
-		(card->info.type != QETH_CARD_TYPE_OSN) ?
-		&qeth_l2_ethtool_ops : &qeth_l2_osn_ops;
+	if (card->info.type == QETH_CARD_TYPE_OSN) {
+		card->dev->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->info.broadcast_capable = 1;
 	qeth_l2_request_initial_mac(card);

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.18 00/33] 3.18.56-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 06/33] s390/qeth: avoid null pointer dereference on OSN Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 23/33] mm/migrate: fix refcount handling when !hugepage_migration_supported() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 20/33] ALSA: hda - apply STAC_9200_DELL_M22 quirk for Dell Latitude D430 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 12/33] ipv6: Check ip6_find_1stfragopt() return value properly. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 16/33] sctp: fix ICMP processing if skb is non-linear Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 30/33] xfs: fix up quotacheck buffer list error handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:20 +0200
  [PATCH 3.18 22/33] drm/gma500/psb: Actually use VBT mode when it is found Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 18:30 +0200
  [PATCH 3.18 33/33] xfs: fix unaligned access in xfs_btree_visit_blocks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 08/33] sctp: fix src address selection if using secondary addresses for ipv6 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 14/33] ipv6: fix out of bound writes in __ip6_append_data() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 29/33] xfs: prevent multi-fsb dir readahead from reading random blocks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 32/33] xfs: bad assertion for delalloc an extent that start at i_size Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 27/33] xfs: fix over-copying of getbmap parameters from userspace Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 21/33] slub/memcg: cure the brainless abuse of sysfs attributes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  [PATCH 3.18 31/33] xfs: fix indlen accounting error on partial delalloc conversion Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-05 19:40 +0200
  Re: [PATCH 3.18 01/33] Revert "stackprotector: Increase the per-task  stack canarys random range from 32 bits to 64 bits on 64-bit platforms" Kees Cook <keescook@chromium.org> - 2017-06-05 21:20 +0200
    Re: [kernel-hardening] Re: [PATCH 3.18 01/33] Revert  "stackprotector: Increase the per-task stack canarys random range from 32  bits to 64 bits on 64-bit platforms" Eric Biggers <ebiggers3@gmail.com> - 2017-06-05 22:10 +0200
      Re: [kernel-hardening] Re: [PATCH 3.18 01/33] Revert  "stackprotector: Increase the per-task stack canarys random range from 32  bits to 64 bits on 64-bit platforms" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-06 09:30 +0200
  Re: [PATCH 3.18 00/33] 3.18.56-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-06-05 22:40 +0200
  Re: [PATCH 3.18 00/33] 3.18.56-stable review Guenter Roeck <linux@roeck-us.net> - 2017-06-06 00:10 +0200
  Re: [PATCH 3.18 00/33] 3.18.56-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-06 09:30 +0200
    Re: [PATCH 3.18 00/33] 3.18.56-stable review Kevin Hilman <khilman@baylibre.com> - 2017-06-06 23:00 +0200

csiph-web