Re: [GIT PULL] fscrypt fix for 6.1-rc3

From: Linus Torvalds
Date: Fri Oct 28 2022 - 12:53:32 EST


On Thu, Oct 27, 2022 at 8:13 PM Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
>
> Thanks Linus. That makes sense in general, but in this case ->s_master_keys
> gets used in the middle of the function, in fscrypt_put_master_key_activeref().

Ouch. I tried to look for things like that, but it's clearly indirect
through 'mk' so I missed it.

All the callers except for put_crypt_info() do seem to have the 'sb'
pointer, and I _think_ sb is inode->i_sb in that case. And this seems
to *literally* be the only use of 'mk->mk_sb' in the whole data
structure, so I think it's all wrong, and that field just shouldn't
exist at all, but be passed into the (only) user as an argument.

Oh well. Whatever. I think the code is ugly, but it is what it is. It
may not be worth the churn of fixing.

Linus