From 8d90a9d27b0ef28ddcdd3eb041c8a9d019b84b50 Mon Sep 17 00:00:00 2001 From: Yadavendra Yadav Date: Thu, 5 Mar 2020 07:21:55 +0000 Subject: [PATCH] LINUX: Initialize CellLRU during osi_Init When OpenAFS kernel module gets loaded, it will create certain entries in "proc" filesystem. One of those entries is "CellServDB", in case we read "/proc/fs/openafs/CellServDB" without starting "afsd" it will result in crash with NULL pointer deref. The reason for crash is CellLRU has not been initialized yet (since "afsd" is not started) i.e afs_CellInit is not yet called, because of this "next" and "prev" pointers will be NULL. Inside "c_start()" we do not check for NULL pointer while traversing CellLRU and this causes crash. To avoid this initialize CellLRU during module intialization. Change-Id: I21cbc0e016b384f0ab456c05087384b6ed986b0d Reviewed-on: https://gerrit.openafs.org/14093 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- src/afs/LINUX/osi_module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 2b48453..47e32cf 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -56,6 +56,12 @@ afs_init(void) #endif osi_Init(); + + /* Initialize CellLRU since it is used while traversing CellServDB proc + * entry */ + + QInit(&CellLRU); + #if !defined(AFS_NONFSTRANS) osi_linux_nfssrv_init(); #endif -- 1.9.4