]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
bindings: fix init pid hashing
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 28 May 2020 09:03:05 +0000 (11:03 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 28 May 2020 15:37:15 +0000 (11:37 -0400)
We were stupidly always hashing entry->ino where entry was just freshly
allocated zeroed-memory so we effectively added stuff to the cache
forever but this meant:
- we never found a match when we hashed the actual inode
- we kept growing the cache
- we leaked memory

Closes: #407.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/bindings.c

index 89ebde56516b4c3a5bcd3a48f591fbfeeb04f724..79a6028e95c6a789b7dee7151576ef113c3bd9f3 100644 (file)
@@ -278,7 +278,7 @@ static void save_initpid(ino_t pidns_inode, pid_t pid)
        if (!entry)
                return;
 
-       ino_hash = HASH(entry->ino);
+       ino_hash = HASH(pidns_inode);
        *entry = (struct pidns_init_store){
                .ino            = pidns_inode,
                .initpid        = pid,