Third set of IIO new device support, cleanups etc for the 5.8 cycle.

A rather late final set to pick up a couple of new drivers, a bunch
of cleanup and some fixes that can wait for the merge window.

In particularly I'd like to highlight the great core and driver
cleanup work that the Alex and the team at Analog devices are currently
doing.  Should see lots more of that in the next cycle give what is
currently under review.

This pull also has the first few fixes squashing a class of alignment
and small kernel data leak bugs that Lars-Peter Clausen picked up
on in a review.  Quite a few more of those to come.  They've been
there a long time so we aren't rushing the reviews.

New device support
* atlas ezo
  - new driver supporting this range of chemical and similar sensors
    with the odd interface of ascii strings over i2c.
* bma180
  - bma023, bma150 and smb380 support.  Note these are currently also
    supported by a driver in input which we will hopefully remove
    (eventually). There are Kconfig protections to avoid a clash
    in the meantime.
* vcnl3020
  - new driver for this proximity sensor.

Core change
* during buffer updates, change the current state variable before
  we actually call pre and post enable callbacks so drivers can know
  where we are going.  Note this is a precursor to only exposing
  one enable callback to drivers.  The (false) logic behind having two
  such callbacks has long been fixed, but only now is the mess getting
  cleaned up.

Features
* exynos adc.
  - add reporting of channels scale values.

Cleanups and minor fixes.
* core
  - drop now unused attrcount_orig variable.
* ad5360, ad5446, ad5449, ad5755, ad5761, ad5764, ad5380, ad5421,
  ad5592, ad5686 and vf610_dac
  - remove direct use of iio_dev->mlock from all these drivers.
    Its semantics used to be poorly defined, but now it is for core
    use only.  Removing it's use in drivers has been a long process
    of which this is the latest step!
* exynos_adc
  - drop a pointless check on the phy as the driver doesn't access it.
* ping
  - avoid a dance from iio_priv and iio_priv_to_dev back again by
    just passing the iio_dev into the functions.
* pms7003
  - alignment and potential data leak fix.
* sps30
  - alignment bug fix.
-----BEGIN PGP SIGNATURE-----

iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl7IBHURHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FohTww//dhtvLTbbKvNRB5pOjmzr4I1IEzOQO5F/
jX+i5cG+V92hQMScc4Whcvxs5yMsi6I1YXzOsuK1HVRWcUmldl4+deZqFhbjKRVS
ODQi401tSAKFSX0/mGHcchfwKAuqZbGM8T2SNDSuvgls7XCgjPThde0Ddm9e40b0
14ObffKzzjBcMqTLMCW9Kk14zIEb7GQF7sy2UW84C0LdVNgck/o2wYNwkMjBgaOP
Lq7ZBH8AUS/k4C4BobpbB9lYc5ZCLluE9qRLbk6LKOOcEEa63+VcQvifbDAPOzGP
CANHIC7Fv7cuFgeGCNSDboOa1h962XrpmuiswfUzLWCH79iiKhhY7DLVAgyOELIv
jak4Nh9EyW879VX1udZJh77Ur2NkA/4WVplGjJ6obVMuA6ChkyHGn9FeFwDHOtcm
gbSMRuw7rDBflZvuA3X5bscgMYBzMGHff8rhX0wnJjuai8Q2qfimzp3FZBlkJnrN
U7+PPBaC+qHQVOLgriDBhtK4YUDplW6RDWW4hFRNRpmm93HDrHyFq7rhLpZRphDt
GlziTxxS27zLu6EcKA3XiAU7H7NrhGlQYIxakU0N9rqyg5Cid3gs6FLlJ8MmP10W
6iIh4/zLOU4gejJDisvKiwbuH0RbobF88jHxnr+LXgB6pg2z36mpsGFL2EUvC384
qnahztvqftw=
=TxOr
-----END PGP SIGNATURE-----
iio:chemical:pms7003: Fix timestamp alignment and prevent data leak.

One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes).  This is not guaranteed in
this driver which uses an array of smaller elements on the stack.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here.  We close both issues by
moving to a suitable structure in the iio_priv() data with alignment
explicitly requested.  This data is allocated with kzalloc so no
data can leak appart from previous readings.

Fixes: a1d642266c14 ("iio: chemical: add support for Plantower PMS7003 sensor")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: <Stable@vger.kernel.org>
Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
1 file changed