Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "crypto: talitos - convert to use be16_add_cpu()"

This reverts commit 7291a932c6e27d9768e374e9d648086636daf61c.

The conversion to be16_add_cpu() is incorrect in case cryptlen is
negative due to premature (i.e. before addition / subtraction)
implicit conversion of cryptlen (int -> u16) leading to sign loss.

Cc: <stable@vger.kernel.org> # 3.10+
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Horia Geant? and committed by
Herbert Xu
69d9cd8c 5fa7dadc

+2 -1
+2 -1
drivers/crypto/talitos.c
··· 1083 1083 sg_count--; 1084 1084 link_tbl_ptr--; 1085 1085 } 1086 - be16_add_cpu(&link_tbl_ptr->len, cryptlen); 1086 + link_tbl_ptr->len = cpu_to_be16(be16_to_cpu(link_tbl_ptr->len) 1087 + + cryptlen); 1087 1088 1088 1089 /* tag end of link table */ 1089 1090 link_tbl_ptr->j_extent = DESC_PTR_LNKTBL_RETURN;