Skip to content

Commit

Permalink
net: ieee802154: fix error return code in dgram_bind()
Browse files Browse the repository at this point in the history
commit 444d8ad upstream.

Fix to return error code -EINVAL from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 9416010 ("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>
  • Loading branch information
Wei Yongjun authored and gregkh committed Nov 3, 2022
1 parent 138a13d commit 5a93a82
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/ieee802154/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5a93a82

Please sign in to comment.