public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: sysfs: Update ROM to include default owner write access
@ 2011-01-05 17:26 Alex Williamson
  2011-01-05 17:46 ` Chris Wright
  2011-01-07 22:27 ` Jesse Barnes
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Williamson @ 2011-01-05 17:26 UTC (permalink / raw)
  To: linux-pci; +Cc: linux-kernel, jbarnes, alex.williamson, chrisw, avi

The PCI sysfs ROM interface requires an enabling write to access
the ROM image, but the default file mode is 0400.  The original
proposed patch adding sysfs ROM support was a true read-only
interface, with the enabling bit coming in as a feature request.
I suspect it was simply an oversight that the file mode didn't
get updated to match the API.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 drivers/pci/pci-sysfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 63d5042..8ecaac9 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1149,7 +1149,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 		sysfs_bin_attr_init(attr);
 		attr->size = rom_size;
 		attr->attr.name = "rom";
-		attr->attr.mode = S_IRUSR;
+		attr->attr.mode = S_IRUSR | S_IWUSR;
 		attr->read = pci_read_rom;
 		attr->write = pci_write_rom;
 		retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: sysfs: Update ROM to include default owner write access
  2011-01-05 17:26 [PATCH] PCI: sysfs: Update ROM to include default owner write access Alex Williamson
@ 2011-01-05 17:46 ` Chris Wright
  2011-01-07 22:27 ` Jesse Barnes
  1 sibling, 0 replies; 3+ messages in thread
From: Chris Wright @ 2011-01-05 17:46 UTC (permalink / raw)
  To: Alex Williamson; +Cc: linux-pci, linux-kernel, jbarnes, chrisw, avi

* Alex Williamson (alex.williamson@redhat.com) wrote:
> The PCI sysfs ROM interface requires an enabling write to access
> the ROM image, but the default file mode is 0400.  The original
> proposed patch adding sysfs ROM support was a true read-only
> interface, with the enabling bit coming in as a feature request.
> I suspect it was simply an oversight that the file mode didn't
> get updated to match the API.

This is often not an issue given normal root capabilities, but once
we strip those capabilities, the default 0400 causes O_RDWR to fail.
As Alex said, given the only way to use the file is to write to it first,
making it writable makes sense.

> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Acked-by: Chris Wright <chrisw@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: sysfs: Update ROM to include default owner write access
  2011-01-05 17:26 [PATCH] PCI: sysfs: Update ROM to include default owner write access Alex Williamson
  2011-01-05 17:46 ` Chris Wright
@ 2011-01-07 22:27 ` Jesse Barnes
  1 sibling, 0 replies; 3+ messages in thread
From: Jesse Barnes @ 2011-01-07 22:27 UTC (permalink / raw)
  To: Alex Williamson; +Cc: linux-pci, linux-kernel, chrisw, avi

On Wed, 05 Jan 2011 10:26:41 -0700
Alex Williamson <alex.williamson@redhat.com> wrote:

> The PCI sysfs ROM interface requires an enabling write to access
> the ROM image, but the default file mode is 0400.  The original
> proposed patch adding sysfs ROM support was a true read-only
> interface, with the enabling bit coming in as a feature request.
> I suspect it was simply an oversight that the file mode didn't
> get updated to match the API.
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
> 
>  drivers/pci/pci-sysfs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index 63d5042..8ecaac9 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -1149,7 +1149,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
>  		sysfs_bin_attr_init(attr);
>  		attr->size = rom_size;
>  		attr->attr.name = "rom";
> -		attr->attr.mode = S_IRUSR;
> +		attr->attr.mode = S_IRUSR | S_IWUSR;
>  		attr->read = pci_read_rom;
>  		attr->write = pci_write_rom;
>  		retval = sysfs_create_bin_file(&pdev->dev.kobj, attr);

Applied, thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-07 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 17:26 [PATCH] PCI: sysfs: Update ROM to include default owner write access Alex Williamson
2011-01-05 17:46 ` Chris Wright
2011-01-07 22:27 ` Jesse Barnes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox