Skip to content

Commit 5c874a5

Browse files
committed
Merge tag 'Smack-for-5.14' of git://github.com/cschaufler/smack-next
Pull smack updates from Casey Schaufler: "There is nothing more significant than an improvement to a byte count check in smackfs. All changes have been in next for weeks" * tag 'Smack-for-5.14' of git://github.com/cschaufler/smack-next: Smack: fix doc warning Revert "Smack: Handle io_uring kernel thread privileges" smackfs: restrict bytes count in smk_set_cipso() security/smack/: fix misspellings using codespell tool
2 parents 290fe0f + fe6bde7 commit 5c874a5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

security/smack/smack_access.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void smack_log_callback(struct audit_buffer *ab, void *a)
332332
* @object_label : smack label of the object being accessed
333333
* @request: requested permissions
334334
* @result: result from smk_access
335-
* @a: auxiliary audit data
335+
* @ad: auxiliary audit data
336336
*
337337
* Audit the granting or denial of permissions in accordance
338338
* with the policy.
@@ -396,6 +396,7 @@ struct hlist_head smack_known_hash[SMACK_HASH_SLOTS];
396396

397397
/**
398398
* smk_insert_entry - insert a smack label into a hash map,
399+
* @skp: smack label
399400
*
400401
* this function must be called under smack_known_lock
401402
*/
@@ -476,8 +477,10 @@ char *smk_parse_smack(const char *string, int len)
476477

477478
/**
478479
* smk_netlbl_mls - convert a catset to netlabel mls categories
480+
* @level: MLS sensitivity level
479481
* @catset: the Smack categories
480482
* @sap: where to put the netlabel categories
483+
* @len: number of bytes for the levels in a CIPSO IP option
481484
*
482485
* Allocates and fills attr.mls
483486
* Returns 0 on success, error code on failure.
@@ -688,10 +691,9 @@ bool smack_privileged_cred(int cap, const struct cred *cred)
688691
bool smack_privileged(int cap)
689692
{
690693
/*
691-
* Kernel threads may not have credentials we can use.
692-
* The io_uring kernel threads do have reliable credentials.
694+
* All kernel tasks are privileged
693695
*/
694-
if ((current->flags & (PF_KTHREAD | PF_IO_WORKER)) == PF_KTHREAD)
696+
if (unlikely(current->flags & PF_KTHREAD))
695697
return true;
696698

697699
return smack_privileged_cred(cap, current_cred());

security/smack/smackfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ static int smk_parse_rule(const char *data, struct smack_parsed_rule *rule,
380380
* @data: string to be parsed, null terminated
381381
* @rule: Will be filled with Smack parsed rule
382382
* @import: if non-zero, import labels
383-
* @tokens: numer of substrings expected in data
383+
* @tokens: number of substrings expected in data
384384
*
385385
* Returns number of processed bytes on success, -ERRNO on failure.
386386
*/
@@ -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)