* [PATCH] ipv4: inet_bind: check the addr_len first
@ 2015-06-02 9:08 Denis Kirjanov
2015-06-04 2:38 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Denis Kirjanov @ 2015-06-02 9:08 UTC (permalink / raw)
To: netdev; +Cc: Denis Kirjanov
Perform the address length check first, before calling
the the proto specific bind() function
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
net/ipv4/af_inet.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 6ad0f7a..333e2fa 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -426,14 +426,15 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
int chk_addr_ret;
int err;
+ err = -EINVAL;
+ if (addr_len < sizeof(struct sockaddr_in))
+ goto out;
+
/* If the socket has its own bind function then use it. (RAW) */
if (sk->sk_prot->bind) {
err = sk->sk_prot->bind(sk, uaddr, addr_len);
goto out;
}
- err = -EINVAL;
- if (addr_len < sizeof(struct sockaddr_in))
- goto out;
if (addr->sin_family != AF_INET) {
/* Compatibility games : accept AF_UNSPEC (mapped to AF_INET)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv4: inet_bind: check the addr_len first
2015-06-02 9:08 [PATCH] ipv4: inet_bind: check the addr_len first Denis Kirjanov
@ 2015-06-04 2:38 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-06-04 2:38 UTC (permalink / raw)
To: kda; +Cc: netdev
From: Denis Kirjanov <kda@linux-powerpc.org>
Date: Tue, 2 Jun 2015 12:08:00 +0300
> Perform the address length check first, before calling
> the the proto specific bind() function
>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
This doesn't fix any actual bug, doesn't improve the code in
preparation for another change that actually benefits from
this adjustment, and so this is really an unwanted change.
This change and it's commit log message look totally arbitrary
and opaque, even to people who have been working with this
code and it's interfaces for decades. That should tell you
something.
You have to let us know exactly why you are making a change, and what
real _actual_ bug it fixes, when you want us to consider your changes
seriously.
I'm not applying this, sorry.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-04 2:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 9:08 [PATCH] ipv4: inet_bind: check the addr_len first Denis Kirjanov
2015-06-04 2:38 ` David Miller
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).