* [PATCH] selinux: endian fix
@ 2006-05-16 15:23 Alexey Dobriyan
2006-05-16 15:54 ` James Morris
0 siblings, 1 reply; 8+ messages in thread
From: Alexey Dobriyan @ 2006-05-16 15:23 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Stephen Smalley, James Morris
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3231,7 +3231,7 @@ static int selinux_socket_sock_rcv_skb(s
goto out;
/* Handle mapped IPv4 packets arriving via IPv6 sockets */
- if (family == PF_INET6 && skb->protocol == ntohs(ETH_P_IP))
+ if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
family = PF_INET;
read_lock_bh(&sk->sk_callback_lock);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 15:23 [PATCH] selinux: endian fix Alexey Dobriyan
@ 2006-05-16 15:54 ` James Morris
2006-05-16 16:24 ` Andreas Schwab
2006-05-17 0:55 ` Peter Chubb
0 siblings, 2 replies; 8+ messages in thread
From: James Morris @ 2006-05-16 15:54 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Andrew Morton, linux-kernel, Stephen Smalley
On Tue, 16 May 2006, Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Hmm, I'm certain this was tested (perhaps on a BE machine, though). In any
case skb->protocol should definitely be network byte order.
Acked-by: James Morris <jmorris@namei.org>
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -3231,7 +3231,7 @@ static int selinux_socket_sock_rcv_skb(s
> goto out;
>
> /* Handle mapped IPv4 packets arriving via IPv6 sockets */
> - if (family == PF_INET6 && skb->protocol == ntohs(ETH_P_IP))
> + if (family == PF_INET6 && skb->protocol == htons(ETH_P_IP))
> family = PF_INET;
>
> read_lock_bh(&sk->sk_callback_lock);
>
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 15:54 ` James Morris
@ 2006-05-16 16:24 ` Andreas Schwab
2006-05-16 16:30 ` James Morris
` (2 more replies)
2006-05-17 0:55 ` Peter Chubb
1 sibling, 3 replies; 8+ messages in thread
From: Andreas Schwab @ 2006-05-16 16:24 UTC (permalink / raw)
To: James Morris
Cc: Alexey Dobriyan, Andrew Morton, linux-kernel, Stephen Smalley
James Morris <jmorris@namei.org> writes:
> On Tue, 16 May 2006, Alexey Dobriyan wrote:
>
>> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>
> Hmm, I'm certain this was tested (perhaps on a BE machine, though).
ntohs and htons are identical operations. Either you swap or you don't,
but there is only one way to swap a short.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 16:24 ` Andreas Schwab
@ 2006-05-16 16:30 ` James Morris
2006-05-16 16:34 ` Al Viro
2006-05-16 17:42 ` Jan Engelhardt
2 siblings, 0 replies; 8+ messages in thread
From: James Morris @ 2006-05-16 16:30 UTC (permalink / raw)
To: Andreas Schwab
Cc: Alexey Dobriyan, Andrew Morton, linux-kernel, Stephen Smalley
On Tue, 16 May 2006, Andreas Schwab wrote:
> ntohs and htons are identical operations. Either you swap or you don't,
> but there is only one way to swap a short.
Indeed.
--
James Morris
<jmorris@namei.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 16:24 ` Andreas Schwab
2006-05-16 16:30 ` James Morris
@ 2006-05-16 16:34 ` Al Viro
2006-05-16 17:42 ` Jan Engelhardt
2 siblings, 0 replies; 8+ messages in thread
From: Al Viro @ 2006-05-16 16:34 UTC (permalink / raw)
To: Andreas Schwab
Cc: James Morris, Alexey Dobriyan, Andrew Morton, linux-kernel,
Stephen Smalley
On Tue, May 16, 2006 at 06:24:14PM +0200, Andreas Schwab wrote:
> James Morris <jmorris@namei.org> writes:
>
> > On Tue, 16 May 2006, Alexey Dobriyan wrote:
> >
> >> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> >
> > Hmm, I'm certain this was tested (perhaps on a BE machine, though).
>
> ntohs and htons are identical operations. Either you swap or you don't,
> but there is only one way to swap a short.
Indeed, but that kind of crap still deserves a fix - same result, but
use that kind of misuse is begging for bugs later on.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 16:24 ` Andreas Schwab
2006-05-16 16:30 ` James Morris
2006-05-16 16:34 ` Al Viro
@ 2006-05-16 17:42 ` Jan Engelhardt
2006-05-16 17:50 ` Andreas Schwab
2 siblings, 1 reply; 8+ messages in thread
From: Jan Engelhardt @ 2006-05-16 17:42 UTC (permalink / raw)
To: Andreas Schwab
Cc: James Morris, Alexey Dobriyan, Andrew Morton, linux-kernel,
Stephen Smalley
>>> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>>
>> Hmm, I'm certain this was tested (perhaps on a BE machine, though).
>
>ntohs and htons are identical operations. Either you swap or you don't,
>but there is only one way to swap a short.
>
...unless PDPs start to get attractive again. :>
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 17:42 ` Jan Engelhardt
@ 2006-05-16 17:50 ` Andreas Schwab
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2006-05-16 17:50 UTC (permalink / raw)
To: Jan Engelhardt
Cc: James Morris, Alexey Dobriyan, Andrew Morton, linux-kernel,
Stephen Smalley
Jan Engelhardt <jengelh@linux01.gwdg.de> writes:
>>>> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>>>
>>> Hmm, I'm certain this was tested (perhaps on a BE machine, though).
>>
>>ntohs and htons are identical operations. Either you swap or you don't,
>>but there is only one way to swap a short.
>>
> ...unless PDPs start to get attractive again. :>
No. There are only two ways to order two bytes.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] selinux: endian fix
2006-05-16 15:54 ` James Morris
2006-05-16 16:24 ` Andreas Schwab
@ 2006-05-17 0:55 ` Peter Chubb
1 sibling, 0 replies; 8+ messages in thread
From: Peter Chubb @ 2006-05-17 0:55 UTC (permalink / raw)
To: James Morris
Cc: Alexey Dobriyan, Andrew Morton, linux-kernel, Stephen Smalley
>>>>> "James" == James Morris <jmorris@namei.org> writes:
James> On Tue, 16 May 2006, Alexey Dobriyan wrote:
>> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
James> Hmm, I'm certain this was tested (perhaps on a BE machine,
James> though). In any case skb->protocol should definitely be network
James> byte order.
On all architectures, ntohs is the same as htons -- either the two
bytes are swapped or they're not.
--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au ERTOS within National ICT Australia
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-05-17 0:55 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-16 15:23 [PATCH] selinux: endian fix Alexey Dobriyan
2006-05-16 15:54 ` James Morris
2006-05-16 16:24 ` Andreas Schwab
2006-05-16 16:30 ` James Morris
2006-05-16 16:34 ` Al Viro
2006-05-16 17:42 ` Jan Engelhardt
2006-05-16 17:50 ` Andreas Schwab
2006-05-17 0:55 ` Peter Chubb
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).