From: YOSHIFUJI Hideaki / 吉藤英明 Date: Thu, 13 Dec 2012 04:29:36 +0000 (+0000) Subject: ndisc: Fix padding error in link-layer address option. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7bdc1b4abab3af0a803300f706c9814ef4e20a3e;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git ndisc: Fix padding error in link-layer address option. 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 Signed-off-by: David S. Miller --- diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 4c02e6ab96e7..f2a007b7bde3 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;