Hi Paul,

Today's linux-next merge of the audit tree got a conflict in
kernel/auditsc.c between commit 4a92843601ad ("audit: correctly record
file names with different path name types") and fcf22d8267ad ("audit:
create private file name copies when auditing inodes") from Linus' tree
and commits 997f7ee82a98 ("audit: enable filename recording via
getname_kernel()"), 2b1b63a2b7d3 ("audit: fix filename matching in
__audit_inode() and __audit_inode_child()") and 49463ee9d929 ("audit:
replace getname()/putname() hacks with reference counters") from the
audit tree.

It would have been nice if these new audit tree commits had been based
on v3.19-rc3 instead of v3.16 ... (especially since their Author dates
match their Committer dates).

I fixed it up (basically I used the audit tree versions - based on the
commit comments - see below) and can carry the fix as necessary (no
action is required).

-- 
Cheers,
Stephen Rothwell                    s...@canb.auug.org.au

diff --cc kernel/auditsc.c
index 55f82fce2526,459a54555151..000000000000
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@@ -1878,48 -1802,17 +1804,15 @@@ void __audit_inode(struct filename *nam
        }
  
  out_alloc:
 -      /* unable to find the name from a previous getname(). Allocate a new
 -       * anonymous entry.
 -       */
 +      /* unable to find an entry with both a matching name and type */
-       n = audit_alloc_name(context, AUDIT_TYPE_UNKNOWN);
+       n = audit_alloc_name(context, AUDIT_TYPE_NORMAL);
        if (!n)
                return;
-       /* unfortunately, while we may have a path name to record with the
-        * inode, we can't always rely on the string lasting until the end of
-        * the syscall so we need to create our own copy, it may fail due to
-        * memory allocation issues, but we do our best */
        if (name) {
-               /* we can't use getname_kernel() due to size limits */
-               size_t len = strlen(name->name) + 1;
-               struct filename *new = __getname();
- 
-               if (unlikely(!new))
-                       goto out;
- 
-               if (len <= (PATH_MAX - sizeof(*new))) {
-                       new->name = (char *)(new) + sizeof(*new);
-                       new->separate = false;
-               } else if (len <= PATH_MAX) {
-                       /* this looks odd, but is due to final_putname() */
-                       struct filename *new2;
- 
-                       new2 = kmalloc(sizeof(*new2), GFP_KERNEL);
-                       if (unlikely(!new2)) {
-                               __putname(new);
-                               goto out;
-                       }
-                       new2->name = (char *)new;
-                       new2->separate = true;
-                       new = new2;
-               } else {
-                       /* we should never get here, but let's be safe */
-                       __putname(new);
-                       goto out;
-               }
-               strlcpy((char *)new->name, name->name, len);
-               new->uptr = NULL;
-               new->aname = n;
-               n->name = new;
-               n->name_put = true;
+               n->name = name;
+               name->refcnt++;
        }
+ 
  out:
        if (parent) {
                n->name_len = n->name ? parent_len(n->name->name) : 
AUDIT_NAME_FULL;

Attachment: pgp6_OmcN6TBN.pgp
Description: OpenPGP digital signature

Reply via email to