* [PATCH] cifs: fix srcip_matches() for ipv6
@ 2013-01-17 2:36 Nickolai Zeldovich
2013-01-17 3:51 ` Steve French
2013-01-17 16:24 ` Jeff Layton
0 siblings, 2 replies; 5+ messages in thread
From: Nickolai Zeldovich @ 2013-01-17 2:36 UTC (permalink / raw)
To: Steve French; +Cc: Nickolai Zeldovich, linux-cifs, linux-kernel
srcip_matches() previously had code like this:
srcip_matches(..., struct sockaddr *rhs) {
/* ... */
struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *) &rhs;
return ipv6_addr_equal(..., &vaddr6->sin6_addr);
}
which interpreted the values on the stack after the 'rhs' pointer as an
ipv6 address. The correct thing to do is to use 'rhs', not '&rhs'.
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
---
fs/cifs/connect.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 17c3643..12b3da3 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
}
case AF_INET6: {
struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
- struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs;
+ struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
}
default:
--
1.7.10.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cifs: fix srcip_matches() for ipv6
2013-01-17 2:36 [PATCH] cifs: fix srcip_matches() for ipv6 Nickolai Zeldovich
@ 2013-01-17 3:51 ` Steve French
2013-01-17 4:04 ` Nickolai Zeldovich
2013-01-17 16:24 ` Jeff Layton
1 sibling, 1 reply; 5+ messages in thread
From: Steve French @ 2013-01-17 3:51 UTC (permalink / raw)
To: Nickolai Zeldovich; +Cc: Steve French, linux-cifs, linux-kernel
Makes sense.
How did you discover this - did you have an ipv6 test case or by
inspection or ...?
On Wed, Jan 16, 2013 at 8:36 PM, Nickolai Zeldovich
<nickolai@csail.mit.edu> wrote:
> srcip_matches() previously had code like this:
>
> srcip_matches(..., struct sockaddr *rhs) {
> /* ... */
> struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *) &rhs;
> return ipv6_addr_equal(..., &vaddr6->sin6_addr);
> }
>
> which interpreted the values on the stack after the 'rhs' pointer as an
> ipv6 address. The correct thing to do is to use 'rhs', not '&rhs'.
>
> Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
> ---
> fs/cifs/connect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 17c3643..12b3da3 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
> }
> case AF_INET6: {
> struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
> - struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs;
> + struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
> return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
> }
> default:
> --
> 1.7.10.4
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cifs: fix srcip_matches() for ipv6
2013-01-17 3:51 ` Steve French
@ 2013-01-17 4:04 ` Nickolai Zeldovich
2013-01-21 7:41 ` Steve French
0 siblings, 1 reply; 5+ messages in thread
From: Nickolai Zeldovich @ 2013-01-17 4:04 UTC (permalink / raw)
To: Steve French; +Cc: Steve French, linux-cifs, linux-kernel
On Wed, Jan 16, 2013 at 10:51 PM, Steve French <smfrench@gmail.com> wrote:
> How did you discover this - did you have an ipv6 test case or by
> inspection or ...?
By mostly-automated inspection (i.e., with the help of a static
program analysis tool).
Nickolai.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cifs: fix srcip_matches() for ipv6
2013-01-17 2:36 [PATCH] cifs: fix srcip_matches() for ipv6 Nickolai Zeldovich
2013-01-17 3:51 ` Steve French
@ 2013-01-17 16:24 ` Jeff Layton
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Layton @ 2013-01-17 16:24 UTC (permalink / raw)
To: Nickolai Zeldovich; +Cc: Steve French, linux-cifs, linux-kernel
On Wed, 16 Jan 2013 21:36:17 -0500
Nickolai Zeldovich <nickolai@csail.mit.edu> wrote:
> srcip_matches() previously had code like this:
>
> srcip_matches(..., struct sockaddr *rhs) {
> /* ... */
> struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *) &rhs;
> return ipv6_addr_equal(..., &vaddr6->sin6_addr);
> }
>
> which interpreted the values on the stack after the 'rhs' pointer as an
> ipv6 address. The correct thing to do is to use 'rhs', not '&rhs'.
>
> Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
> ---
> fs/cifs/connect.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 17c3643..12b3da3 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -1917,7 +1917,7 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
> }
> case AF_INET6: {
> struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
> - struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)&rhs;
> + struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
> return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
> }
> default:
Nice catch...
Reviewed-by: Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cifs: fix srcip_matches() for ipv6
2013-01-17 4:04 ` Nickolai Zeldovich
@ 2013-01-21 7:41 ` Steve French
0 siblings, 0 replies; 5+ messages in thread
From: Steve French @ 2013-01-21 7:41 UTC (permalink / raw)
To: Nickolai Zeldovich; +Cc: Steve French, linux-cifs, linux-kernel
merged into cifs-2.6.git
On Wed, Jan 16, 2013 at 10:04 PM, Nickolai Zeldovich
<nickolai@csail.mit.edu> wrote:
> On Wed, Jan 16, 2013 at 10:51 PM, Steve French <smfrench@gmail.com> wrote:
>> How did you discover this - did you have an ipv6 test case or by
>> inspection or ...?
>
> By mostly-automated inspection (i.e., with the help of a static
> program analysis tool).
>
> Nickolai.
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-21 7:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-17 2:36 [PATCH] cifs: fix srcip_matches() for ipv6 Nickolai Zeldovich
2013-01-17 3:51 ` Steve French
2013-01-17 4:04 ` Nickolai Zeldovich
2013-01-21 7:41 ` Steve French
2013-01-17 16:24 ` Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®