Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Phonet: fix oops in phonet_address_del() on non-Phonet device

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>

authored by

Rémi Denis-Courmont and committed by
David S. Miller
7e5ab542 3ec19255

+1 -1
+1 -1
net/phonet/pn_dev.c
··· 115 115 pnd = __phonet_get(dev); 116 116 if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs)) 117 117 err = -EADDRNOTAVAIL; 118 - if (bitmap_empty(pnd->addrs, 64)) 118 + else if (bitmap_empty(pnd->addrs, 64)) 119 119 __phonet_device_free(pnd); 120 120 spin_unlock_bh(&pndevs.lock); 121 121 return err;