Skip to content

Commit

Permalink
selinux: conditionally reschedule in hashtab_insert while loading sel…
Browse files Browse the repository at this point in the history
…inux policy

After silencing the sleeping warning in mls_convert_context() I started
seeing similar traces from hashtab_insert. Do a cond_resched there too.

Signed-off-by: Dave Jones <davej@redhat.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
  • Loading branch information
Dave Jones authored and Serge Hallyn committed Jun 3, 2014
1 parent 9a591f3 commit ed1c964
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions security/selinux/ss/hashtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include "hashtab.h"

struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
Expand Down Expand Up @@ -40,6 +41,8 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
u32 hvalue;
struct hashtab_node *prev, *cur, *newnode;

cond_resched();

if (!h || h->nel == HASHTAB_MAX_NODES)
return -EINVAL;

Expand Down

0 comments on commit ed1c964

Please sign in to comment.