Skip to content

Commit 444d8ad

Browse files
Wei YongjunStefan-Schmidt
authored andcommitted
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: 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>
1 parent 68fe1db commit 444d8ad

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

net/ieee802154/socket.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,10 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
502502
if (err < 0)
503503
goto out;
504504

505-
if (addr->family != AF_IEEE802154)
505+
if (addr->family != AF_IEEE802154) {
506+
err = -EINVAL;
506507
goto out;
508+
}
507509

508510
ieee802154_addr_from_sa(&haddr, &addr->addr);
509511
dev = ieee802154_get_dev(sock_net(sk), &haddr);

0 commit comments

Comments
 (0)