diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2020-10-26 11:01:27 +0300 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2020-10-28 03:05:57 +0300 |
commit | 0d8cb9464a7d9c3e6349db3f7719a80f3793347e (patch) | |
tree | 07f4c5b9b8e05a5127f1fb9761bffed8881d7931 | |
parent | 6c211809c87f0de939f3bd60ceec05338ae6eba1 (diff) | |
download | linux-0d8cb9464a7d9c3e6349db3f7719a80f3793347e.tar.xz |
devlink: Unlock on error in dumpit()
This needs to unlock before returning.
Fixes: 544e7c33ec2f ("net: devlink: Add support for port regions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20201026080127.GB1628785@mwanda
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r-- | net/core/devlink.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/devlink.c b/net/core/devlink.c index 925da7c0fcf3..a932d95be798 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c @@ -4919,8 +4919,10 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb, index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]); port = devlink_port_get_by_index(devlink, index); - if (!port) - return -ENODEV; + if (!port) { + err = -ENODEV; + goto out_unlock; + } } region_name = nla_data(attrs[DEVLINK_ATTR_REGION_NAME]); |