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 623B87E for ; Wed, 2 Nov 2022 03:03:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72B74C433C1; Wed, 2 Nov 2022 03:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1667358180; bh=gagRoc1PCa6Ou1GKb1Z/z9uOaU5o/QH4birrMvATaIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U2rSBrY6ZD3ViG2FohROqW82sDBWyTnDDczDz3IfJqYLUoLeyTlO3FxCZ2GGU1cYM 0whi/Ua4jCyzJXr2v1cSctjfjppNFkTJL1rvc60k0NCFvIXxShJG4ofxzM+bOoEZvK PQ/Jp3271j0k160Dgqx5Oj6ZSa0wd2C52mfXw24g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Yongjun , Stefan Schmidt Subject: [PATCH 5.15 055/132] net: ieee802154: fix error return code in dgram_bind() Date: Wed, 2 Nov 2022 03:32:41 +0100 Message-Id: <20221102022101.058594024@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221102022059.593236470@linuxfoundation.org> References: <20221102022059.593236470@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 @@ -502,8 +502,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);