Re: [PATCH v3] mmc: block: Fix bug when removing RPMB chardev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/10/17 12:09, Linus Walleij wrote:
> On Wed, Oct 4, 2017 at 9:39 AM, Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote:
> 
>>> @@ -2299,7 +2299,7 @@ static int mmc_rpmb_chrdev_open(struct inode *inode, struct file *filp)
>>>       get_device(&rpmb->dev);
>>>       filp->private_data = rpmb;
>>>       mutex_lock(&open_lock);
>>> -     rpmb->md->usage++;
>>> +     mmc_blk_get(rpmb->md->disk);
>>
>> mmc_blk_get() also tries to mutex_lock(&open_lock)
> 
> Yeah :/ I fix.
> Sorry for this flunky (too)...
> 
>> But how do you know md still exists?
> 
> I was thinking that the reference counting is exactly for making sure
> it exists across open()/close()?

Previously the device being opened was the block device which had to exist.

But I think it is OK to assume md exists in mmc_rpmb_chrdev_open() because
rpmb->chrdev is removed before the main disk.

> 
>>  Looks like you need
>> to make the disk the parent of the rpmb device and then
>> use the disk to get a reference to md.
> 
> That sounds like it can be done relatively easily. Sounds like it should be a
> separate patch though, let me iterate this one first so we plug the biggest
> holes and then I try to come up with something for that too.

OK.  What about the "capable(CAP_SYS_RAWIO)" question?
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux