net/ncsi: unlock on error in ncsi_set_interface_nl()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 8 Mar 2018 09:36:28 +0000 (12:36 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Mar 2018 02:49:58 +0000 (21:49 -0500)
There are two error paths which are missing unlocks in this function.

Fixes: 955dc68cb9b2 ("net/ncsi: Add generic netlink family")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ncsi/ncsi-netlink.c

index b73239b76349c5ef5abd1c40b3bd31f291d2021d..05fcfb4fbe1de4601151d8564039ac22408c5d13 100644 (file)
@@ -299,6 +299,7 @@ static int ncsi_set_interface_nl(struct sk_buff *msg, struct genl_info *info)
                        package = np;
        if (!package) {
                /* The user has set a package that does not exist */
+               spin_unlock_irqrestore(&ndp->lock, flags);
                return -ERANGE;
        }
 
@@ -317,6 +318,7 @@ static int ncsi_set_interface_nl(struct sk_buff *msg, struct genl_info *info)
                /* The user has set a channel that does not exist on this
                 * package
                 */
+               spin_unlock_irqrestore(&ndp->lock, flags);
                netdev_info(ndp->ndev.dev, "NCSI: Channel %u does not exist!\n",
                            channel_id);
                return -ERANGE;