power: rk81x-battery: disable charge over time funtion
[firefly-linux-kernel-4.4.55.git] / security / lsm_audit.c
index 90c129b0102f5cbe43129695bde3c3b924b84987..8f6b8e8a4cc8ae4ec6e93da615e4fe5ec23f35a3 100644 (file)
@@ -213,12 +213,15 @@ static void dump_common_audit_data(struct audit_buffer *ab,
 {
        struct task_struct *tsk = current;
 
-       if (a->tsk)
-               tsk = a->tsk;
-       if (tsk && tsk->pid) {
-               audit_log_format(ab, " pid=%d comm=", tsk->pid);
-               audit_log_untrustedstring(ab, tsk->comm);
-       }
+       /*
+        * To keep stack sizes in check force programers to notice if they
+        * start making this union too large!  See struct lsm_network_audit
+        * as an example of how to deal with large data.
+        */
+       BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2);
+
+       audit_log_format(ab, " pid=%d comm=", tsk->pid);
+       audit_log_untrustedstring(ab, tsk->comm);
 
        switch (a->type) {
        case LSM_AUDIT_DATA_NONE:
@@ -242,6 +245,21 @@ static void dump_common_audit_data(struct audit_buffer *ab,
                }
                break;
        }
+       case LSM_AUDIT_DATA_IOCTL_OP: {
+               struct inode *inode;
+
+               audit_log_d_path(ab, " path=", &a->u.op->path);
+
+               inode = a->u.op->path.dentry->d_inode;
+               if (inode) {
+                       audit_log_format(ab, " dev=");
+                       audit_log_untrustedstring(ab, inode->i_sb->s_id);
+                       audit_log_format(ab, " ino=%lu", inode->i_ino);
+               }
+
+               audit_log_format(ab, " ioctlcmd=%hx", a->u.op->cmd);
+               break;
+       }
        case LSM_AUDIT_DATA_DENTRY: {
                struct inode *inode;