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

Greg KH
2005-02-09T18:18:15Z

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