Skip to content

Commit 135122f

Browse files
Tetsuo Handagregkh
authored andcommitted
smackfs: restrict bytes count in smk_set_cipso()
commit 49ec114 upstream. Oops, I failed to update subject line. From 07571157c91b98ce1a4aa70967531e64b78e8346 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa <[email protected]> Date: Mon, 12 Apr 2021 22:25:06 +0900 Subject: smackfs: restrict bytes count in smk_set_cipso() Commit 7ef4c19 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case. Reported-by: syzbot <[email protected]> Signed-off-by: Tetsuo Handa <[email protected]> Signed-off-by: Casey Schaufler <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a21e5cb commit 135122f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

security/smack/smackfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,8 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,
855855
if (format == SMK_FIXED24_FMT &&
856856
(count < SMK_CIPSOMIN || count > SMK_CIPSOMAX))
857857
return -EINVAL;
858+
if (count > PAGE_SIZE)
859+
return -EINVAL;
858860

859861
data = memdup_user_nul(buf, count);
860862
if (IS_ERR(data))

0 commit comments

Comments
 (0)