summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorandrea merello <andrea.merello@gmail.com>2014-02-18 02:10:43 +0100
committerJohn W. Linville <linville@tuxdriver.com>2014-02-28 14:08:28 -0500
commit4da18bb4fb53537a279fe899620de9af4bf4695c (patch)
treee8f8ba87b4ca09aec59495bb9eaa8c232ffca627 /drivers/net
parentec1da08dd721f53b97e792c749d236907c764932 (diff)
downloadtalos-obmc-linux-4da18bb4fb53537a279fe899620de9af4bf4695c.tar.gz
talos-obmc-linux-4da18bb4fb53537a279fe899620de9af4bf4695c.zip
rtl818x: make dev_alloc_skb() null pointer check to really work
During driver initialization, some skbs are preallocated for RX. Currenly if the allocation fails, the driver's allocation routine exits immediatly but it will return zero (success) anyway. In this way the driver will continue initialization with buggy pointers around. This patch makes the driver's allocation routine to return an error value and to print a complaint message when skb allocation fails. In this way its caller will not go further, avoinding the driver to successfully load, and preventing dereferencing buggy pointers. An hint is thus printed about why the driver failed. Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rtl818x/rtl8180/dev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c
index 0102da2f145a..a9af83ef24ad 100644
--- a/drivers/net/wireless/rtl818x/rtl8180/dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c
@@ -476,9 +476,10 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
struct sk_buff *skb = dev_alloc_skb(MAX_RX_SIZE);
dma_addr_t *mapping;
entry = &priv->rx_ring[i];
- if (!skb)
- return 0;
-
+ if (!skb) {
+ wiphy_err(dev->wiphy, "Cannot allocate RX skb\n");
+ return -ENOMEM;
+ }
priv->rx_buf[i] = skb;
mapping = (dma_addr_t *)skb->cb;
*mapping = pci_map_single(priv->pdev, skb_tail_pointer(skb),
OpenPOWER on IntegriCloud