summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2021-05-19 14:16:14 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-10 12:43:50 +0200
commit1294bdc0d385edfd58dc3a76482d63822cccb6d7 (patch)
treeb0b34017cfb10f1fd93fb076cdd7ac435123de3a
parentb207c5c344861ab43e44235f4551ef1e3692f199 (diff)
downloadlinux-stable-1294bdc0d385edfd58dc3a76482d63822cccb6d7.tar.gz
linux-stable-1294bdc0d385edfd58dc3a76482d63822cccb6d7.tar.bz2
linux-stable-1294bdc0d385edfd58dc3a76482d63822cccb6d7.zip
ieee802154: fix error return code in ieee802154_llsec_getparams()
[ Upstream commit 373e864cf52403b0974c2f23ca8faf9104234555 ] Fix to return negative error code -ENOBUFS from the error handling case instead of 0, as done elsewhere in this function. Fixes: 3e9c156e2c21 ("ieee802154: add netlink interfaces for llsec") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20210519141614.3040055-1-weiyongjun1@huawei.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/ieee802154/nl-mac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index c0930b9fe848..7531cb1665d2 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -688,8 +688,10 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info)
nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) ||
nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
be32_to_cpu(params.frame_counter)) ||
- ieee802154_llsec_fill_key_id(msg, &params.out_key))
+ ieee802154_llsec_fill_key_id(msg, &params.out_key)) {
+ rc = -ENOBUFS;
goto out_free;
+ }
dev_put(dev);