diff mbox series

[2/2,net-next] net/ncsi: unlock on error in ncsi_set_interface_nl()

Message ID 20180308093628.GD16525@mwanda
State Accepted, archived
Delegated to: David Miller
Headers show
Series [1/2,net-next] net/ncsi: use kfree_skb() instead of kfree() | expand

Commit Message

Dan Carpenter March 8, 2018, 9:36 a.m. UTC
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>

Comments

David Miller March 9, 2018, 2:50 a.m. UTC | #1
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 8 Mar 2018 12:36:28 +0300

> 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>

Also applied, thanks Dan.
diff mbox series

Patch

diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c
index b73239b76349..05fcfb4fbe1d 100644
--- a/net/ncsi/ncsi-netlink.c
+++ b/net/ncsi/ncsi-netlink.c
@@ -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;