]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Phonet: fix oops in phonet_address_del() on non-Phonet device
authorRémi Denis-Courmont <remi.denis-courmont@nokia.com>
Wed, 26 Nov 2008 23:26:43 +0000 (15:26 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Nov 2008 23:26:43 +0000 (15:26 -0800)
A NULL dereference would occur when trying to delete an addres from a
network device that does not have any Phonet address.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/phonet/pn_dev.c

index 53be9fc82aaadb2a0aa588974b13d603491ee0b0..f93ff8ef47d0f8d47635af976c4fab46b8fcd1ce 100644 (file)
@@ -115,7 +115,7 @@ int phonet_address_del(struct net_device *dev, u8 addr)
        pnd = __phonet_get(dev);
        if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs))
                err = -EADDRNOTAVAIL;
-       if (bitmap_empty(pnd->addrs, 64))
+       else if (bitmap_empty(pnd->addrs, 64))
                __phonet_device_free(pnd);
        spin_unlock_bh(&pndevs.lock);
        return err;