* [PATCH] ndisc: Fix padding error in link-layer address option.
@ 2012-12-13 14:29 YOSHIFUJI Hideaki
2012-12-13 18:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: YOSHIFUJI Hideaki @ 2012-12-13 14:29 UTC (permalink / raw)
To: davem, netdev; +Cc: yoshfuji
If a natural number n exists where 2 + data_len <= 8n < 2 + data_len + pad,
post padding is not initialized correctly.
(Un)fortunately, the only type that requires pad is Infiniband,
whose pad is 2 and data_len is 20, and this logical error has not
become obvious, but it is better to fix.
Note that ndisc_opt_addr_space() handles the situation described
above correctly.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
net/ipv6/ndisc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 92909d2..2ed42c8 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -151,8 +151,8 @@ static inline int ndisc_opt_addr_space(struct net_device *dev)
static u8 *ndisc_fill_addr_option(u8 *opt, int type, void *data, int data_len,
unsigned short addr_type)
{
- int space = NDISC_OPT_SPACE(data_len);
int pad = ndisc_addr_option_pad(addr_type);
+ int space = NDISC_OPT_SPACE(data_len + pad);
opt[0] = type;
opt[1] = space>>3;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ndisc: Fix padding error in link-layer address option.
2012-12-13 14:29 [PATCH] ndisc: Fix padding error in link-layer address option YOSHIFUJI Hideaki
@ 2012-12-13 18:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-12-13 18:01 UTC (permalink / raw)
To: yoshfuji; +Cc: netdev
From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Thu, 13 Dec 2012 23:29:36 +0900
> If a natural number n exists where 2 + data_len <= 8n < 2 + data_len + pad,
> post padding is not initialized correctly.
>
> (Un)fortunately, the only type that requires pad is Infiniband,
> whose pad is 2 and data_len is 20, and this logical error has not
> become obvious, but it is better to fix.
>
> Note that ndisc_opt_addr_space() handles the situation described
> above correctly.
>
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-13 18:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 14:29 [PATCH] ndisc: Fix padding error in link-layer address option YOSHIFUJI Hideaki
2012-12-13 18:01 ` 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).