From: Wei Yongjun Date: Mon, 19 Sep 2022 16:08:30 +0000 (+0000) Subject: net: ieee802154: fix error return code in dgram_bind() X-Git-Tag: v4.9.332~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7948db093eacf6ae88f3d31d0bf754a1bfa982d2;p=thirdparty%2Fkernel%2Fstable.git 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 Link: https://lore.kernel.org/r/20220919160830.1436109-1-weiyongjun@huaweicloud.com Signed-off-by: Stefan Schmidt Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index aadd445ea88ac..d48fba155981c 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -516,8 +516,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);