From: NeilBrown Date: Mon, 6 Feb 2017 02:41:39 +0000 (+1100) Subject: md: ensure md devices are freed before module is unloaded. X-Git-Tag: v3.2.89~55 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a44059c1c1fac3c721fa0c34bd2de8b4853fd1a3;p=pandora-kernel.git md: ensure md devices are freed before module is unloaded. commit 9356863c9409efc79029c01a85d015efae977e69 upstream. Commit: cbd199837750 ("md: Fix unfortunate interaction with evms") change mddev_put() so that it would not destroy an md device while ->ctime was non-zero. Unfortunately, we didn't make sure to clear ->ctime when unloading the module, so it is possible for an md device to remain after module unload. An attempt to open such a device will trigger an invalid memory reference in: get_gendisk -> kobj_lookup -> exact_lock -> get_disk when tring to access disk->fops, which was in the module that has been removed. So ensure we clear ->ctime in md_exit(), and explain how that is useful, as it isn't immediately obvious when looking at the code. Fixes: cbd199837750 ("md: Fix unfortunate interaction with evms") Tested-by: Guoqing Jiang Signed-off-by: NeilBrown Signed-off-by: Shaohua Li Signed-off-by: Ben Hutchings --- Reading git-diff-tree failed