Re: [PATCH 1/2 v6] mmc: block: Convert RPMB to a character device

Shawn Lin
2017-09-28T03:56:21Z

On 2017/9/28 3:45, Linus Walleij wrote:
> On Wed, Sep 27, 2017 at 1:35 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>
>> BUG when removing, fixed by reverting this patch.
>>
>> [ 346.548512] mmc1: card 0001 removed
>> [ 346.552782] BUG: unable to handle kernel NULL pointer dereference at 0000000000000070
>
> How did you achieve this? I need to reproduce it.
>
> RPMB is only available on eMMC cards and I don't have a removable eMMC
> card since by definition they are soldered on.
>
> Does it happen on an ordinary MMC card without RPMB?
>
> I'm sorry if I'm ignorant of something very obvious here...
>
> I will read the code and see if I'm missing something obvious.

Haven't closely look at this patch, but btw, don't you need
put_device(&rpmb->dev) for the error path of mmc_blk_alloc_rpmb_part
and also do that for mmc_blk_remove_rpmb_part?

And don't you need to check rpmb->md->usage when doing
mmc_blk_remove_rpmb_part ?

>
> Yours,
> Linus Walleij
>
>
>