summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2022-09-19 16:08:30 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-11-03 23:50:54 +0900
commit0ba32d40be425ac8316adb9427f3ca7e590b22cf (patch)
treedb5870405113750d59486e2dc93cb2abb4b69230
parent629c986e19fe9481227c7cdfd9a105bbc104d245 (diff)
downloadlinux-0ba32d40be425ac8316adb9427f3ca7e590b22cf.tar.gz
linux-0ba32d40be425ac8316adb9427f3ca7e590b22cf.tar.bz2
linux-0ba32d40be425ac8316adb9427f3ca7e590b22cf.zip
net: ieee802154: fix error return code in dgram_bind()
commit 444d8ad4916edec8a9fc684e841287db9b1e999f upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 a8929675b5ab..a13b10867b6f 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -515,8 +515,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);