lkml.org 
[lkml]   [2006]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] Add MMC Password Protection (lock/unlock) support V8: mmc_sysfs.diff
On Mon, Dec 04, 2006 at 04:13:39PM -0400, Anderson Briglia wrote:
> Implement MMC password force erase, remove password, change password,
> unlock card and assign password operations. It uses the sysfs mechanism
> to send commands to the MMC subsystem.

Sorry, this is still unsuitable for mainline.

> Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar <at> indt.org.br>
> Signed-off-by: Anderson Lizardo <anderson.lizardo <at> indt.org.br>
> Signed-off-by: Anderson Briglia <anderson.briglia <at> indt.org.br>

Please use the standard format, do not obfuscate these. The kernel
community utterly abhors this.

> +/*
> + * implement MMC password functions: force erase, remove password, change
> + * password, unlock card and assign password.
> + */
> +static ssize_t
> +mmc_lockable_store(struct device *dev, struct device_attribute *att,
> + const char *data, size_t len)
> +{
> + struct mmc_card *card = dev_to_mmc_card(dev);
> + int err = 0;

Where is the check that the host can do byte-wise data transfers?

> +
> + err = mmc_card_claim_host(card);
> + if (err != MMC_ERR_NONE)
> + return -EINVAL;
> +
> + if (!mmc_card_lockable(card))
> + return -EINVAL;

So writing to this file with a card which is not lockable results in
deadlocking the host. Suggest you do as other subsystems do and have
one exit path, and use gotos, setting the appropriate return code in a
variable. If everything goes via that it forces you to think about
where you want to jump to in each case.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-12-15 20:39    [W:0.057 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site