* [PATCH] hdlc: fix null-deref on allocation failure
@ 2015-11-17 22:26 Stephen Hemminger
2015-11-18 20:06 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2015-11-17 22:26 UTC (permalink / raw)
To: Krzysztof Halasa; +Cc: netdev
If alloc_netdev() failed and return NULL, then the next instruction
would dereference it. Found by Coverity.
Compile tested only. Not sure if anyone still uses this driver
(or the whole WAN subsystem).
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
--- a/drivers/net/wan/hdlc_fr.c 2015-08-18 17:45:21.414525304 -0700
+++ b/drivers/net/wan/hdlc_fr.c 2015-11-16 09:50:07.317597825 -0800
@@ -1075,11 +1075,10 @@ static int fr_add_pvc(struct net_device
used = pvc_is_used(pvc);
- if (type == ARPHRD_ETHER) {
+ if (type == ARPHRD_ETHER)
dev = alloc_netdev(0, "pvceth%d", NET_NAME_UNKNOWN,
ether_setup);
- dev->priv_flags &= ~IFF_TX_SKB_SHARING;
- } else
+ else
dev = alloc_netdev(0, "pvc%d", NET_NAME_UNKNOWN, pvc_setup);
if (!dev) {
@@ -1088,9 +1087,10 @@ static int fr_add_pvc(struct net_device
return -ENOBUFS;
}
- if (type == ARPHRD_ETHER)
+ if (type == ARPHRD_ETHER) {
+ dev->priv_flags &= ~IFF_TX_SKB_SHARING;
eth_hw_addr_random(dev);
- else {
+ } else {
*(__be16*)dev->dev_addr = htons(dlci);
dlci_to_q922(dev->broadcast, dlci);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] hdlc: fix null-deref on allocation failure
2015-11-17 22:26 [PATCH] hdlc: fix null-deref on allocation failure Stephen Hemminger
@ 2015-11-18 20:06 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-11-18 20:06 UTC (permalink / raw)
To: shemming; +Cc: khc, netdev
From: Stephen Hemminger <shemming@brocade.com>
Date: Tue, 17 Nov 2015 14:26:06 -0800
> If alloc_netdev() failed and return NULL, then the next instruction
> would dereference it. Found by Coverity.
>
> Compile tested only. Not sure if anyone still uses this driver
> (or the whole WAN subsystem).
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-11-18 20:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 22:26 [PATCH] hdlc: fix null-deref on allocation failure Stephen Hemminger
2015-11-18 20:06 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).