[PATCH v2 6/7] sparc/modules: Add rlimit for sparc modules

From: Rick Edgecombe
Date: Thu Oct 11 2018 - 19:40:31 EST


This adds in the rlimit checking for the sparc module allocator.

This has not been tested.

Signed-off-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
---
arch/sparc/kernel/module.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index df39580f398d..24854fdfa7c3 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -44,10 +44,15 @@ void *module_alloc(unsigned long size)
{
void *ret;

+ if (check_inc_mod_rlimit(size))
+ return NULL;
+
ret = module_map(size);
if (ret)
memset(ret, 0, size);

+ update_mod_rlimit(ret, size);
+
return ret;
}

--
2.17.1