BACKPORT: Smack: parse multiple rules per write to load2, up to PAGE_SIZE-1 bytes
authorRafal Krypa <r.krypa@samsung.com>
Fri, 9 Aug 2013 09:47:07 +0000 (11:47 +0200)
committerRafal Krypa <r.krypa@samsung.com>
Thu, 30 Jun 2016 12:57:28 +0000 (14:57 +0200)
commitc87ffda94097ae19454bef05851c7e313258fbd8
tree1e9b7b085eb82cd3cb4a4b79d2bbacf846911e7d
parent6d141d06a35d85befc154e975a35cd770f87b4d9
BACKPORT: Smack: parse multiple rules per write to load2, up to PAGE_SIZE-1 bytes

Smack interface for loading rules has always parsed only single rule from
data written to it. This requires user program to call one write() per
each rule it wants to load.
This change makes it possible to write multiple rules, separated by new
line character. Smack will load at most PAGE_SIZE-1 characters and properly
return number of processed bytes. In case when user buffer is larger, it
will be additionally truncated. All characters after last \n will not get
parsed to avoid partial rule near input buffer boundary.

Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
(cherry-picked from upstream 10289b0f738e8b301969f2288c4942455f1b1e59)
security/smack/smackfs.c