Re: [Linux-kernel-mentees] [PATCH v2] PCI: sysfs: Change bus_rescan and dev_rescan to rescan

From: Bjorn Helgaas
Date: Sat Mar 28 2020 - 15:59:37 EST


On Thu, Mar 26, 2020 at 12:29:11AM -0600, Kelsey wrote:
> On Wed, Mar 25, 2020 at 4:10 PM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:

> > Thanks for taking care of this! Two questions:
> >
> > 1) You supplied permissions of 0220, but DEVICE_ATTR_WO()
> > uses__ATTR_WO(), which uses 0200. Shouldn't we keep 0200?
> >
>
> Good catch. Before changing to DEVICE_ATTR_WO(), the permissions used
> was (S_IWUSR | S_IWGRP), which would be 0220. This means the
> permissions were mistakenly changed from 0220 to 0200 in the same
> patch:
>
> commit 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")
>
> To verify DEVICE_ATTR_WO() is using __ATTR_WO() can be seen in
> /include/linux/device.h
> To verify permissions for __ATTR_WO() is 0200 can be seen in
> /inlcude/linux/sysfs.h
>
> These attributes had permissions 0220 when first being introduced and
> before the above mentioned patch, so I'm on the side to believe that
> 0220 should be used.

I'm not sure it was a mistake that 4e2b79436e4f changed from 0220 to
200 or not. I'd say __ATTR_WO (0200) is the "standard" one, and we
should have a special reason to use 0220.