summaryrefslogtreecommitdiffstats
path: root/net/ieee802154
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2022-09-19 16:08:30 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2022-10-07 09:29:17 +0200
commit444d8ad4916edec8a9fc684e841287db9b1e999f (patch)
treedcd8ddd6226586f4de50cc6ed3ca65a8f8f6748c /net/ieee802154
parent68fe1db04443cee58ddbeae9c506f7262b256168 (diff)
downloadlinux-stable-444d8ad4916edec8a9fc684e841287db9b1e999f.tar.gz
linux-stable-444d8ad4916edec8a9fc684e841287db9b1e999f.tar.bz2
linux-stable-444d8ad4916edec8a9fc684e841287db9b1e999f.zip
net: ieee802154: fix error return code in dgram_bind()
Fix to return error code -EINVAL from the error handling case instead of 0, as done elsewhere in this function. Fixes: 94160108a70c ("net/ieee802154: fix uninit value bug in dgram_sendmsg") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Link: https://lore.kernel.org/r/20220919160830.1436109-1-weiyongjun@huaweicloud.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index 6e55fae4c686..1fa2fe041ec0 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -502,8 +502,10 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
if (err < 0)
goto out;
- if (addr->family != AF_IEEE802154)
+ if (addr->family != AF_IEEE802154) {
+ err = -EINVAL;
goto out;
+ }
ieee802154_addr_from_sa(&haddr, &addr->addr);
dev = ieee802154_get_dev(sock_net(sk), &haddr);