Re: [PATCH 14/33] vfs: Implement a filesystem superblock creation/configuration context [ver #11]
From: Sergey Senozhatsky
Date: Tue Sep 18 2018 - 05:07:43 EST
Hi,
On (09/11/18 16:54), Guenter Roeck wrote:
> On Wed, Sep 12, 2018 at 12:17:35AM +0100, David Howells wrote:
> > Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
> >
> > > [ 8.507672] RIP: 0010:reconfigure_super+0x47/0x210
> >
> > Can you tell me the file and line this corresponds to?
> >
> I don't know, but some debugging shows that fc->ops == NULL.
This NULL derefs linux-next.
Emergency (sysrq remount/reboot):
emergency_remount()
do_emergency_remount()
do_emergency_remount_callback()
reconfigure_super()
At fc->ops dereference:
981 if (fc->ops->reconfigure) {
^^^^^^^^^
982 retval = fc->ops->reconfigure(fc);
983 if (retval == 0) {
984 security_sb_reconfigure(fc);
So the check either better be
if (fc->ops && fc->ops->reconfigure)
Or, we need to set ->ops properly. But I'm not sure if invoking
->init_fs_context() from emergency-reboot path is going to work
well all the time.
---
fs/super.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/super.c b/fs/super.c
index efb0567c8389..e2e03c47c817 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1017,6 +1017,7 @@ int reconfigure_super(struct fs_context *fc)
static void do_emergency_remount_callback(struct super_block *sb)
{
struct fs_context fc = {
+ .ops = &legacy_fs_context_ops,
.purpose = FS_CONTEXT_FOR_EMERGENCY_RO,
.fs_type = sb->s_type,
.root = sb->s_root,
---
-ss