From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2227F629 for ; Wed, 2 Nov 2022 03:23:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225E5C433C1; Wed, 2 Nov 2022 03:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667359387; bh=17+J7JxAl3dF+s7KK9zHCVMsf6hstPoQIOqO5hERor4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0itlcZ2+geqRRfqIWBWnciI3t6Jtw9iy/JCuSTMFbRQq7SVe52L/El5Pu7EiumUWp u17KGR3KzYhk1/SeHDym7oLpajSjCbxXODGYeBbzAyNeC367yZzoHuo44CveyJl6+f hG9HKFnmoTwLswMdtIyKNtGNs/KJP6wlvApwog7o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Yongjun , Stefan Schmidt Subject: [PATCH 5.4 30/64] net: ieee802154: fix error return code in dgram_bind() Date: Wed, 2 Nov 2022 03:33:56 +0100 Message-Id: <20221102022052.795836781@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022051.821538553@linuxfoundation.org> References: <20221102022051.821538553@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Wei Yongjun 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 --- net/ieee802154/socket.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -507,8 +507,10 @@ static int dgram_bind(struct sock *sk, s 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);