From: Kees Cook Date: Fri, 6 Jun 2014 21:37:18 +0000 (-0700) Subject: sysctl: refactor sysctl string writing logic X-Git-Tag: omap-for-v3.16/fixes-against-rc1~91^2~4^2~76 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ca9bb456ada8bcbdc8f77f8fc78207653bbaa92;p=pandora-kernel.git sysctl: refactor sysctl string writing logic Consolidate buffer length checking with new-line/end-of-line checking. Additionally, instead of reading user memory twice, just do the assignment during the loop. This change doesn't affect the potential races here. It was already possible to read a sysctl that was in the middle of a write. In both cases, the string will always be NULL terminated. The pre-existing race remains a problem to be solved. Signed-off-by: Kees Cook Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed