linux-wpan.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ieee802154: fix error return code in dgram_bind()
@ 2022-09-19 16:08 Wei Yongjun
  2022-10-07  7:44 ` Stefan Schmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2022-09-19 16:08 UTC (permalink / raw)
  To: Haimin Zhang, Alexander Aring, Stefan Schmidt, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Wei Yongjun, linux-wpan, netdev

From: Wei Yongjun <weiyongjun1@huawei.com>

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 <weiyongjun1@huawei.com>
---
 net/ieee802154/socket.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
index 7889e1ef7fad..35c54dce74f9 100644
--- a/net/ieee802154/socket.c
+++ b/net/ieee802154/socket.c
@@ -498,8 +498,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);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ieee802154: fix error return code in dgram_bind()
  2022-09-19 16:08 [PATCH] net: ieee802154: fix error return code in dgram_bind() Wei Yongjun
@ 2022-10-07  7:44 ` Stefan Schmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Schmidt @ 2022-10-07  7:44 UTC (permalink / raw)
  To: Wei Yongjun, Haimin Zhang, Alexander Aring, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Wei Yongjun, linux-wpan, netdev

Hello.

On 19.09.22 18:08, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> 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 <weiyongjun1@huawei.com>
> ---
>   net/ieee802154/socket.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c
> index 7889e1ef7fad..35c54dce74f9 100644
> --- a/net/ieee802154/socket.c
> +++ b/net/ieee802154/socket.c
> @@ -498,8 +498,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);
> 

This patch has been applied to the wpan tree and will be
part of the next pull request to net. Thanks!

regards
Stefan Schmidt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-07  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19 16:08 [PATCH] net: ieee802154: fix error return code in dgram_bind() Wei Yongjun
2022-10-07  7:44 ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).