LINUX: Initialize CellLRU during osi_Init 93/14093/9
authorYadavendra Yadav <yadayada@in.ibm.com>
Thu, 5 Mar 2020 07:21:55 +0000 (07:21 +0000)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Mar 2020 15:56:16 +0000 (10:56 -0500)
commit8d90a9d27b0ef28ddcdd3eb041c8a9d019b84b50
treecb9fd0dc1f078693d4325cf62330942a910d5005
parent914193fa31af1f2aa9d755ce2215608b643053d0
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 <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/LINUX/osi_module.c