* [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
@ 2011-12-28 10:46 Shashidhar hiremath
2011-12-28 11:11 ` Kishore Kadiyala
2011-12-28 12:09 ` Adrian Hunter
0 siblings, 2 replies; 5+ messages in thread
From: Shashidhar hiremath @ 2011-12-28 10:46 UTC (permalink / raw)
To: Arnd Bergmann, Chris Ball, Andrei Warkentin, Adrian Hunter
Cc: linux-mmc, Shashidhar Hiremath
From: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
The Patch adds a check to disable the IOCTL from running when the card is mounted
or device is opened elsewhere.
Signed-off-by: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
---
drivers/mmc/card/block.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 0cad48a..e680929 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
err = -EINVAL;
goto cmd_done;
}
+ /* Disallow the IOCTL run if card is already mounted or device is
+ * opened elsewhere */
+ if (md->usage > 3) {
+ err = -EINVAL;
+ goto cmd_done;
+ }
card = md->queue.card;
if (IS_ERR(card)) {
--
1.7.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
2011-12-28 10:46 [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted Shashidhar hiremath
@ 2011-12-28 11:11 ` Kishore Kadiyala
2011-12-28 12:09 ` Adrian Hunter
1 sibling, 0 replies; 5+ messages in thread
From: Kishore Kadiyala @ 2011-12-28 11:11 UTC (permalink / raw)
To: Shashidhar hiremath
Cc: Arnd Bergmann, Chris Ball, Andrei Warkentin, Adrian Hunter,
linux-mmc
On Wed, Dec 28, 2011 at 5:46 AM, Shashidhar hiremath
<shashidharh@vayavyalabs.com> wrote:
> From: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>
> The Patch adds a check to disable the IOCTL from running when the card is mounted
> or device is opened elsewhere.
>
> Signed-off-by: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
> ---
> drivers/mmc/card/block.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 0cad48a..e680929 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
> err = -EINVAL;
> goto cmd_done;
> }
> + /* Disallow the IOCTL run if card is already mounted or device is
> + * opened elsewhere */
Fix multi line comment
Can refer : Documentation/kernel-doc-nano-HOWTO.txt
> + if (md->usage > 3) {
> + err = -EINVAL;
> + goto cmd_done;
> + }
>
> card = md->queue.card;
> if (IS_ERR(card)) {
> --
> 1.7.6.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
2011-12-28 10:46 [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted Shashidhar hiremath
2011-12-28 11:11 ` Kishore Kadiyala
@ 2011-12-28 12:09 ` Adrian Hunter
2011-12-28 12:46 ` Shashidhar Hiremath
1 sibling, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2011-12-28 12:09 UTC (permalink / raw)
To: Shashidhar hiremath
Cc: Arnd Bergmann, Chris Ball, Andrei Warkentin, Adrian Hunter,
linux-mmc
On 28/12/11 12:46, Shashidhar hiremath wrote:
> From: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>
> The Patch adds a check to disable the IOCTL from running when the card is mounted
> or device is opened elsewhere.
What if someone wants to do that.
Generally the kernel does not prevent access to raw block devices
just because a file system is mounted on them, so I guess MMC should
not either.
>
> Signed-off-by: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
> ---
> drivers/mmc/card/block.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 0cad48a..e680929 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
> err = -EINVAL;
> goto cmd_done;
> }
> + /* Disallow the IOCTL run if card is already mounted or device is
> + * opened elsewhere */
> + if (md->usage > 3) {
> + err = -EINVAL;
> + goto cmd_done;
> + }
Checking the usage will not work consistently e.g.
if there is a sysfs access or another ioctl access at the
same time, or just some other kernel user of the device.
>
> card = md->queue.card;
> if (IS_ERR(card)) {
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
2011-12-28 12:09 ` Adrian Hunter
@ 2011-12-28 12:46 ` Shashidhar Hiremath
2011-12-28 13:11 ` Adrian Hunter
0 siblings, 1 reply; 5+ messages in thread
From: Shashidhar Hiremath @ 2011-12-28 12:46 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Arnd Bergmann, Chris Ball, Andrei Warkentin, linux-mmc
On Wed, Dec 28, 2011 at 5:39 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 28/12/11 12:46, Shashidhar hiremath wrote:
>> From: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>>
>> The Patch adds a check to disable the IOCTL from running when the card is mounted
>> or device is opened elsewhere.
>
> What if someone wants to do that.
The issue with not having this is that if there is huge size data
transfer operation happening, the IOCTL issuing will corrupt the data
transfer operation. So it would be better to finish the device's
access by one thing and give control to ioctl after that.
>
> Generally the kernel does not prevent access to raw block devices
> just because a file system is mounted on them, so I guess MMC should
> not either.
>
>
>>
>> Signed-off-by: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>> ---
>> drivers/mmc/card/block.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 0cad48a..e680929 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
>> err = -EINVAL;
>> goto cmd_done;
>> }
>> + /* Disallow the IOCTL run if card is already mounted or device is
>> + * opened elsewhere */
>> + if (md->usage > 3) {
>> + err = -EINVAL;
>> + goto cmd_done;
>> + }
>
> Checking the usage will not work consistently e.g.
> if there is a sysfs access or another ioctl access at the
> same time, or just some other kernel user of the device.
>
>>
>> card = md->queue.card;
>> if (IS_ERR(card)) {
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
regards,
Shashidhar Hiremath
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted
2011-12-28 12:46 ` Shashidhar Hiremath
@ 2011-12-28 13:11 ` Adrian Hunter
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Hunter @ 2011-12-28 13:11 UTC (permalink / raw)
To: Shashidhar Hiremath
Cc: Arnd Bergmann, Chris Ball, Andrei Warkentin, linux-mmc
On 28/12/11 14:46, Shashidhar Hiremath wrote:
> On Wed, Dec 28, 2011 at 5:39 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>> On 28/12/11 12:46, Shashidhar hiremath wrote:
>>> From: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>>>
>>> The Patch adds a check to disable the IOCTL from running when the card is mounted
>>> or device is opened elsewhere.
>>
>> What if someone wants to do that.
> The issue with not having this is that if there is huge size data
> transfer operation happening, the IOCTL issuing will corrupt the data
> transfer operation. So it would be better to finish the device's
> access by one thing and give control to ioctl after that.
It does claim the host so the ioctl will wait while I/O requests
are being processed.
>>
>> Generally the kernel does not prevent access to raw block devices
>> just because a file system is mounted on them, so I guess MMC should
>> not either.
>
>>
>>
>>>
>>> Signed-off-by: Shashidhar Hiremath <shashidharh@vayavyalabs.com>
>>> ---
>>> drivers/mmc/card/block.c | 6 ++++++
>>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 0cad48a..e680929 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -387,6 +387,12 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev,
>>> err = -EINVAL;
>>> goto cmd_done;
>>> }
>>> + /* Disallow the IOCTL run if card is already mounted or device is
>>> + * opened elsewhere */
>>> + if (md->usage > 3) {
>>> + err = -EINVAL;
>>> + goto cmd_done;
>>> + }
>>
>> Checking the usage will not work consistently e.g.
>> if there is a sysfs access or another ioctl access at the
>> same time, or just some other kernel user of the device.
>>
>>>
>>> card = md->queue.card;
>>> if (IS_ERR(card)) {
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-28 13:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-28 10:46 [PATCH 1/1] mmc: Check to disable IOCTL when card is mounted Shashidhar hiremath
2011-12-28 11:11 ` Kishore Kadiyala
2011-12-28 12:09 ` Adrian Hunter
2011-12-28 12:46 ` Shashidhar Hiremath
2011-12-28 13:11 ` Adrian Hunter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.