Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241663

Re: [PATCH v2 1/3] nvmem: core: make default user binary file root-access only

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/3] nvmem: core: make default user binary file root-access only
Date 2015-10-07 18:30 +0200
Message-ID <qgZLl-1IJ-27@gated-at.bofh.it> (permalink)
References <qgULE-2Y1-13@gated-at.bofh.it> <qgULE-2Y1-19@gated-at.bofh.it> <qgVeF-3vT-1@gated-at.bofh.it> <qgXgt-6rH-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 07, 2015 at 02:46:56PM +0100, Srinivas Kandagatla wrote:
> 
> 
> On 07/10/15 12:33, Russell King - ARM Linux wrote:
> >On Wed, Oct 07, 2015 at 12:00:47PM +0100, Srinivas Kandagatla wrote:
> >>As required by many providers like at24/at25/mxs-ocotp/qfprom and may be
> >>other providers would want to allow root-only to read the nvmem content.
> >>So making the defaults to be root-only access would address the request
> >>and also provide flexibility to providers to specify there own permissions
> >>on top of the root-only using the perm flag in nvmem_config.
> >>Making this dynamic did cut down lot of static binary attributes in the
> >>code.
> >
> >Check what the lifetime of a struct bin_attribute is before you embed it
> >into any other structure.  Sorry, but I think you're going to have to
> 
> Lifetime of the "static struct bin_attribute bin_attr_template" is static
> and a memcpy of which is made into nvmem->bin whose lifetime is till the
> nvmem_release() which happens at device_release(), so there should be no
> issue in using a copy of bin_attribute.

You're assuming that code doesn't touch the attribute after releasing
the last refcount on the device... unless you've actually checked
that, the code is unsafe.

I'm not saying it does or it doesn't (I don't know) but unless you
actually have checked, you haven't done sufficient homework prior to
sending this patch.

Just remember for next time you want to do something similar to this.

-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
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/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/3] nvmem: make sysfs binary file permissions more flexible. Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-07 13:10 +0200
  [PATCH v2 1/3] nvmem: core: make default user binary file root-access only Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-07 13:10 +0200
    Re: [PATCH v2 1/3] nvmem: core: make default user binary file  root-access only Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-10-07 13:40 +0200
      Re: [PATCH v2 1/3] nvmem: core: make default user binary file root-access  only Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-07 15:50 +0200
        Re: [PATCH v2 1/3] nvmem: core: make default user binary file  root-access only Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-10-07 18:30 +0200
    Re: [PATCH v2 1/3] nvmem: core: make default user binary file  root-access only Greg KH <gregkh@linuxfoundation.org> - 2015-10-07 15:00 +0200
      Re: [PATCH v2 1/3] nvmem: core: make default user binary file root-access  only Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2015-10-07 15:20 +0200
        Re: [PATCH v2 1/3] nvmem: core: make default user binary file  root-access only Greg KH <gregkh@linuxfoundation.org> - 2015-10-07 18:20 +0200

csiph-web