OSDN Git Service

rtl8180: avoid potential NULL deref in rtl8180_beacon_work
[uclinux-h8/linux.git] / drivers / net / wireless / rtl818x / rtl8180_dev.c
index d8b186a..b50c39a 100644 (file)
@@ -361,7 +361,7 @@ static int rtl8180_init_hw(struct ieee80211_hw *dev)
 
        /* check success of reset */
        if (rtl818x_ioread8(priv, &priv->map->CMD) & RTL818X_CMD_RESET) {
-               printk(KERN_ERR "%s: reset timeout!\n", wiphy_name(dev->wiphy));
+               wiphy_err(dev->wiphy, "reset timeout!\n");
                return -ETIMEDOUT;
        }
 
@@ -445,8 +445,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev)
                                             &priv->rx_ring_dma);
 
        if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) {
-               printk(KERN_ERR "%s: Cannot allocate RX ring\n",
-                      wiphy_name(dev->wiphy));
+               wiphy_err(dev->wiphy, "cannot allocate rx ring\n");
                return -ENOMEM;
        }
 
@@ -503,8 +502,8 @@ static int rtl8180_init_tx_ring(struct ieee80211_hw *dev,
 
        ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma);
        if (!ring || (unsigned long)ring & 0xFF) {
-               printk(KERN_ERR "%s: Cannot allocate TX ring (prio = %d)\n",
-                      wiphy_name(dev->wiphy), prio);
+               wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n",
+                         prio);
                return -ENOMEM;
        }
 
@@ -569,8 +568,7 @@ static int rtl8180_start(struct ieee80211_hw *dev)
        ret = request_irq(priv->pdev->irq, rtl8180_interrupt,
                          IRQF_SHARED, KBUILD_MODNAME, dev);
        if (ret) {
-               printk(KERN_ERR "%s: failed to register IRQ handler\n",
-                      wiphy_name(dev->wiphy));
+               wiphy_err(dev->wiphy, "failed to register irq handler\n");
                goto err_free_rings;
        }
 
@@ -697,6 +695,8 @@ static void rtl8180_beacon_work(struct work_struct *work)
 
        /* grab a fresh beacon */
        skb = ieee80211_beacon_get(dev, vif);
+       if (!skb)
+               goto resched;
 
        /*
         * update beacon timestamp w/ TSF value
@@ -1107,9 +1107,8 @@ static int __devinit rtl8180_probe(struct pci_dev *pdev,
                goto err_iounmap;
        }
 
-       printk(KERN_INFO "%s: hwaddr %pM, %s + %s\n",
-              wiphy_name(dev->wiphy), mac_addr,
-              chip_name, priv->rf->name);
+       wiphy_info(dev->wiphy, "hwaddr %pm, %s + %s\n",
+                  mac_addr, chip_name, priv->rf->name);
 
        return 0;