Re: [PATCH 1/1] tpm: update tpm sysfs file ownership

From: Greg KH
Date: Wed Feb 09 2005 - 13:20:36 EST


On Wed, Feb 09, 2005 at 12:05:42PM -0600, Kylene Hall wrote:
> @@ -539,9 +551,8 @@ void tpm_remove_hardware(struct device *
> dev_set_drvdata(dev, NULL);
> misc_deregister(&chip->vendor->miscdev);
>
> - device_remove_file(dev, &dev_attr_pubek);
> - device_remove_file(dev, &dev_attr_pcrs);
> - device_remove_file(dev, &dev_attr_caps);
> + for ( i = 0; i < TPM_ATTRS; i++ )
> + device_remove_file(dev, &chip->attr[i]);
>
> dev_mask[chip->dev_num / 32] &= !(1 << (chip->dev_num % 32));
>

This code works?

> @@ -608,6 +619,11 @@ int tpm_register_hardware(struct device
> struct tpm_chip *chip;
> int i, j;
>
> + DEVICE_ATTR(pcrs, S_IRUGO, show_pcrs, NULL);
> + DEVICE_ATTR(pubek, S_IRUGO, show_pubek, NULL);
> + DEVICE_ATTR(caps, S_IRUGO, show_caps, NULL);
> + DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, store_cancel);
> +
> /* Driver specific per-device data */
> chip = kmalloc(sizeof(*chip), GFP_KERNEL);
> if (chip == NULL)

You do realize you just created those attributes on the stack? And then
you try to remove them from within a different scope above?

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/