[OpenAFS-devel] [PATCH] Linux: fix the afs_putname definition when STRUCT_FILENAME_HAS_NAME is defined

Jeff Layton jlayton@redhat.com
Thu, 5 Dec 2013 14:24:54 -0500


The current code has afs_putname defined as

    kmem_cache_free(names_cachep, (void *)name);

This is wrong and will cause a double-free when syscall auditing is
enabled. Fix it to call putname properly.

A better fix might be to just get rid of afs_putname altogether and
call putname directly.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 src/afs/LINUX/osi_compat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 105a7e9..770a2a5 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -577,7 +577,7 @@ afs_name_to_string(afs_name_t s) {
 
 static inline void
 afs_putname(afs_name_t name) {
-    kmem_cache_free(names_cachep, (void *)name);
+    putname(name);
 }
 #endif
 
-- 
1.8.4.2