Error handling:
Pass something you memset'ed to 0 to functions that never change it but
dereference it in dprintk()'s.
This patch removes this broken code - plain Oops'es aren't worse.
As a bonus, this function no longer wastes more than 2 kB stack space.
Signed-off-by: Adrian Bunk <[email protected]>
---
security/slim/slm_main.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
--- linux-2.6.19-mm1/security/slim/slm_main.c.old 2006-12-13 02:58:34.000000000 +0100
+++ linux-2.6.19-mm1/security/slim/slm_main.c 2006-12-13 03:00:06.000000000 +0100
@@ -608,34 +608,21 @@
struct slm_tsec_data *parent_tsec)
{
return enforce_integrity_write(level, name, parent_tsk, parent_tsec);
}
static int slm_set_taskperm(int mask, struct slm_file_xattr *level,
const unsigned char *name)
{
- struct task_struct *parent_tsk = current->parent, new_tsk;
- struct slm_tsec_data *parent_tsec = NULL, new_tsec;
+ struct task_struct *parent_tsk = current->parent;
+ struct slm_tsec_data *parent_tsec;
int rc = 0;
- if (parent_tsk)
- parent_tsec = parent_tsk->security;
- else {
- printk(KERN_INFO
- "%s: current pid %d: parent_tsk is null\n",
- __FUNCTION__, current->pid);
- memset(&new_tsk, 0, sizeof(struct task_struct));
- parent_tsk = &new_tsk;
- }
-
- if (!parent_tsec) {
- memset(&new_tsec, 0, sizeof(struct slm_tsec_data));
- parent_tsec = &new_tsec;
- }
+ parent_tsec = parent_tsk->security;
if (mask & MAY_READ)
rc = do_task_may_read(level, name, parent_tsk, parent_tsec);
if ((mask & MAY_WRITE) || (mask & MAY_APPEND))
rc |= do_task_may_write(level, name, parent_tsk, parent_tsec);
return rc;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]