6lowpan: ndisc: fix double read unlock
authorAlexander Aring <aar@pengutronix.de>
Tue, 21 Jun 2016 08:27:18 +0000 (10:27 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Jul 2016 10:20:57 +0000 (12:20 +0200)
This patch removes a double unlock case to accessing neighbour private
data.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexander Aring <aar@pengutronix.de>
Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/6lowpan/ndisc.c

index ae1d4199aa4ccb0d065ce4fe11ef22a9a2c754c0..030504e031b6d7fc0722f0c8d1275008e5cb71ff 100644 (file)
@@ -135,8 +135,9 @@ static int lowpan_ndisc_opt_addr_space(const struct net_device *dev,
                        read_unlock_bh(&neigh->lock);
                        addr_space += __ndisc_opt_addr_space(IEEE802154_SHORT_ADDR_LEN, 0);
                        *ha = ha_buf;
+               } else {
+                       read_unlock_bh(&neigh->lock);
                }
-               read_unlock_bh(&neigh->lock);
                break;
        case NDISC_NEIGHBOUR_ADVERTISEMENT:
        case NDISC_NEIGHBOUR_SOLICITATION: