summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | ovl: fix documentation of non-standard behaviorMiklos Szeredi2018-07-201-21/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can now drop description of the ro/rw inconsistency from the documentation. Also clarify, that now fully standard compliant behavior can be enabled with kernel/module/mount options. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: obsolete "check_copy_up" module optionMiklos Szeredi2018-07-181-23/+7Star
| | | | | | | | | | | | | | | | | | | | | This was provided for debugging the ro/rw inconsistecy. The inconsitency is now gone so this option is obsolete. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: remove open_flags from d_real()Miklos Szeredi2018-07-185-55/+13Star
| | | | | | | | | | | | | | | | | | | | | | | | Opening regular files on overlayfs is now handled via ovl_open(). Remove the now unused "open_flags" argument from d_op->d_real() and the d_real() helper. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "fsnotify: support overlayfs"Miklos Szeredi2018-07-181-9/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f3fbbb079263bd29ae592478de6808db7e708267. Overlayfs now works correctly without adding hacks to fsnotify. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Partially revert "locks: fix file locking on overlayfs"Miklos Szeredi2018-07-183-24/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This partially reverts commit c568d68341be7030f5647def68851e469b21ca11. Overlayfs files will now automatically get the correct locks, no need to hack overlay support in VFS. It is a partial revert, because it leaves the locks_inode() calls in place and defines locks_inode() to file_inode(). We could revert those as well, but it would be unnecessary code churn and it makes sense to document that we are getting the inode for locking purposes. Don't revert MS_NOREMOTELOCK yet since that has been part of the userspace API for some time (though not in a useful way). Will try to remove internal flags later when the dust around the new mount API settles. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Acked-by: Jeff Layton <jlayton@kernel.org>
| * | Revert "vfs: do get_write_access() on upper layer of overlayfs"Miklos Szeredi2018-07-182-15/+3Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4d0c5ba2ff79ef9f5188998b29fd28fcb05f3667. We now get write access on both overlay and underlying layers so this patch is no longer needed for correct operation. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "vfs: add flags to d_real()"Miklos Szeredi2018-07-186-12/+11Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 495e642939114478a5237a7d91661ba93b76f15a. No user of "flags" argument of d_real() remain. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "vfs: update ovl inode before relatime check"Miklos Szeredi2018-07-184-35/+8Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 598e3c8f72f5b77c84d2cb26cfd936ffb3cfdbaa. Overlayfs no longer relies on the vfs correct atime handling. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "ovl: fix relatime for directories"Miklos Szeredi2018-07-183-23/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit cd91304e7190b4c4802f8e413ab2214b233e0260. Overlayfs no longer relies on the vfs correct atime handling. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: fix freeze protection in mnt_want_write_file() for overlayfsMiklos Szeredi2018-07-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The underlying real file used by overlayfs still contains the overlay path. This results in mnt_want_write_file() calls by the filesystem getting freeze protection on the wrong inode (the overlayfs one instead of the real one). Fix by using file_inode(file)->i_sb instead of file->f_path.mnt->mnt_sb. Reported-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
| * | Revert "ovl: don't allow writing ioctl on lower layer"Miklos Szeredi2018-07-184-70/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7c6893e3c9abf6a9676e060a1e35e5caca673d57. Overlayfs no longer relies on the vfs for checking writability of files. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "ovl: fix may_write_real() for overlayfs directories"Miklos Szeredi2018-07-181-3/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 954c736f865d6c0c68ae4263a2f3502ee7c447a3. Overlayfs no longer relies on the vfs for checking writability of files. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: don't open realMiklos Szeredi2018-07-181-6/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let overlayfs do its thing when opening a file. This enables stacking and fixes the corner case when a file is opened for read, modified through a writable open, and data is read from the read-only file. After this patch the read-only open will not return stale data even in this case. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ovl: add reflink/copyfile/dedup supportMiklos Szeredi2018-07-181-0/+87
| | | | | | | | | | | | | | | | | | Since set of arguments are so similar, handle in a common helper. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add O_DIRECT supportMiklos Szeredi2018-07-181-0/+3
| | | | | | | | | | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_fiemap()Miklos Szeredi2018-07-181-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Implement stacked fiemap(). Need to split inode operations for regular file (which has fiemap) and special file (which doesn't have fiemap). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add lsattr/chattr supportMiklos Szeredi2018-07-181-0/+79
| | | | | | | | | | | | | | | | | | Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_fallocate()Miklos Szeredi2018-07-181-0/+24
| | | | | | | | | | | | | | | | | | Implement stacked fallocate. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_mmap()Miklos Szeredi2018-07-181-0/+32
| | | | | | | | | | | | | | | | | | Implement stacked mmap. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_fsync()Miklos Szeredi2018-07-181-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | Implement stacked fsync(). Don't sync if lower (noticed by Amir Goldstein). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_write_iter()Miklos Szeredi2018-07-181-0/+39
| | | | | | | | | | | | | | | | | | Implement stacked writes. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add ovl_read_iter()Miklos Szeredi2018-07-181-0/+67
| | | | | | | | | | | | | | | | | | Implement stacked reading. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: add helper to return real fileMiklos Szeredi2018-07-181-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the common case we can just use the real file cached in file->private_data. There are two exceptions: 1) File has been copied up since open: in this unlikely corner case just use a throwaway real file for the operation. If ever this becomes a perfomance problem (very unlikely, since overlayfs has been doing most fine without correctly handling this case at all), then we can deal with that by updating the cached real file. 2) File's f_flags have changed since open: no need to reopen the cached real file, we can just change the flags there as well. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: stack file opsMiklos Szeredi2018-07-184-2/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement file operations on a regular overlay file. The underlying file is opened separately and cached in ->private_data. It might be worth making an exception for such files when accounting in nr_file to confirm to userspace expectations. We are only adding a small overhead (248bytes for the struct file) since the real inode and dentry are pinned by overlayfs anyway. This patch doesn't have any effect, since the vfs will use d_real() to find the real underlying file to open. The patch at the end of the series will actually enable this functionality. AV: make it use open_with_fake_path(), don't mess with override_creds SzM: still need to mess with override_creds() until no fs uses current_cred() in their open method. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | ovl: deal with overlay files in ovl_d_real()Miklos Szeredi2018-07-181-0/+4
| | | | | | | | | | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: copy up file size as wellMiklos Szeredi2018-07-182-9/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy i_size of the underlying inode to the overlay inode in ovl_copyattr(). This is in preparation for stacking I/O operations on overlay files. This patch shouldn't have any observable effect. Remove stale comment from ovl_setattr() [spotted by Vivek Goyal]. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Revert "Revert "ovl: get_write_access() in truncate""Miklos Szeredi2018-07-181-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 31c3a7069593b072bd57192b63b62f9a7e994e9a. Re-add functionality dealing with i_writecount on truncate to overlayfs. This patch shouldn't have any observable effects, since we just re-assert the writecout that vfs_truncate() already got for us. This is in preparation for moving overlay functionality out of the VFS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: copy up inode flagsMiklos Szeredi2018-07-182-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | On inode creation copy certain inode flags from the underlying real inode to the overlay inode. This is in preparation for moving overlay functionality out of the VFS. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | ovl: copy up timesMiklos Szeredi2018-07-184-9/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Copy up mtime and ctime to overlay inode after times in real object are modified. Be careful not to dirty cachelines when not necessary. This is in preparation for moving overlay functionality out of the VFS. This patch shouldn't have any observable effect. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: export vfs_dedupe_file_range_one() to modulesMiklos Szeredi2018-07-182-3/+7
| | | | | | | | | | | | | | | | | | This is needed by the stacked dedupe implementation in overlayfs. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: export vfs_ioctl() to modulesMiklos Szeredi2018-07-183-1/+3
| | | | | | | | | | | | | | | | | | This is needed by the stacked ioctl implementation in overlayfs. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | vfs: make open_with_fake_path() not contribute to nr_filesMiklos Szeredi2018-07-184-22/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stacking file operations in overlay will store an extra open file for each overlay file opened. The overhead is just that of "struct file" which is about 256bytes, because overlay already pins an extra dentry and inode when the file is open, which add up to a much larger overhead. For fear of breaking working setups, don't start accounting the extra file. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Merge branch 'dedupe-cleanup' into overlayfs-nextMiklos Szeredi2018-07-186-84/+74Star
| |\ \ | | | | | | | | | | | | Following series for stacking overlay files depends on this mini series.
| | * | vfs: dedupe: extract helper for a single dedupMiklos Szeredi2018-07-061-40/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extract vfs_dedupe_file_range_one() helper to deal with a single dedup request. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
| | * | vfs: dedupe: rationalize argsMiklos Szeredi2018-07-066-20/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clean up f_op->dedupe_file_range() interface. 1) Use loff_t for offsets and length instead of u64 2) Order the arguments the same way as {copy|clone}_file_range(). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
| | * | vfs: dedupe: return intMiklos Szeredi2018-07-066-40/+16Star
| | | | | | | | | | | | | | | | Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| | * | vfs: limit size of dedupeMiklos Szeredi2018-07-061-0/+3
| | |/ | | | | | | | | | | | | Suggested-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| * | Merge branch 'for-ovl' of ↵Miklos Szeredi2018-07-1826-183/+137Star
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs into overlayfs-next This gives us the open_with_fake_path() helper that is needed for stacked open files in overlay and mmap in particular.
| | * | new helper: open_with_fake_path()Al Viro2018-07-122-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | open a file by given inode, faking ->f_path. Use with shitloads of caution - at the very least you'd damn better make sure that some dentry alias of that inode is pinned down by the path in question. Again, this is no general-purpose interface and I hope it will eventually go away. Right now overlayfs wants something like that, but nothing else should. Any out-of-tree code with bright idea of using this one *will* eventually get hurt, with zero notice and great delight on my part. I refuse to use EXPORT_SYMBOL_GPL(), especially in situations when it's really EXPORT_SYMBOL_DONT_USE_IT(), but don't take that export as "you are welcome to use it". Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| * | | ovl: fix wrong use of impure dir cache in ovl_iterate()Amir Goldstein2018-07-171-2/+17
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only upper dir can be impure, but if we are in the middle of iterating a lower real dir, dir could be copied up and marked impure. We only want the impure cache if we started iterating a real upper dir to begin with. Aditya Kali reported that the following reproducer hits the WARN_ON(!cache->refcount) in ovl_get_cache(): docker run --rm drupal:8.5.4-fpm-alpine \ sh -c 'cd /var/www/html/vendor/symfony && \ chown -R www-data:www-data . && ls -l .' Reported-by: Aditya Kali <adityakali@google.com> Tested-by: Aditya Kali <adityakali@google.com> Fixes: 4edb83bb1041 ('ovl: constant d_ino for non-merge dirs') Cc: <stable@vger.kernel.org> # v4.14 Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
* | | Merge tag 'xfs-4.19-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linuxLinus Torvalds2018-08-223-20/+29
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull xfs fixes from Darrick Wong: - Fix an uninitialized variable - Don't use obviously garbage AG header counters to calculate transaction reservations - Trigger icount recalculation on bad icount when mounting * tag 'xfs-4.19-merge-7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: iomap: fix WARN_ON_ONCE on uninitialized variable xfs: sanity check ag header values in xrep_calc_ag_resblks xfs: recalculate summary counters at mount time if icount is bad
| * | | iomap: fix WARN_ON_ONCE on uninitialized variableDarrick J. Wong2018-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit 9dc55f1389f9569 ("iomap: add support for sub-pagesize buffered I/O without buffer heads") we moved the initialization of poff (it's computed from pos) into a separate helper function. Inline data only ever deals with pos == 0, hence the WARN_ON_ONCE, but now we're testing an uninitialized variable. Therefore, change the test to check the parameter directly. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
| * | | xfs: sanity check ag header values in xrep_calc_ag_resblksDarrick J. Wong2018-08-141-19/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check the values we read in from the AG headers when calculating the block reservations for a repair transaction. If they're obviously wrong, substitute worst case assumptions (rather than ENOSPC on a bogus reservation request). Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
| * | | xfs: recalculate summary counters at mount time if icount is badDarrick J. Wong2018-08-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the sb write verifier trips on bad icounts, we should also force a mount time recalculation of the summary counters if the icount is bad. This helps us avoid blowing up at freeze/unmount time when the bad counter gets written back out. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
* | | | Merge tag 'for-v4.19' of ↵Linus Torvalds2018-08-2236-408/+1931
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: - Improve support for TI bq20z75 in sbs-battery - Add Qualcomm PM8xxx reboot driver - Add cros-ec USBPD charger driver - Move ds2760 battery driver from w1 to power-supply and add DT support - Misc fixes * tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (28 commits) power: supply: bq27xxx: Update comments power: supply: max77693_charger: fix unintentional fall-through power: supply: mark expected switch fall-throughs power: supply: lego_ev3_battery: fix Vce offset power: supply: lego_ev3_battery: Don't ignore iio_read_channel_processed() return value power: supply: ds2760_battery: add devicetree probing power: supply: ds2760_battery: merge ds2760 supply driver with its w1 slave companion w1: core: match sub-nodes of bus masters in devicetree dt-bindings: w1: document bindings for ds2760 battery monitor dt-bindings: w1: document generic onewire bindings power: supply: adp5061: Fix a couple off by ones dt-bindings: power: reset: qcom: Add resin binding adp5061: New driver for ADP5061 I2C battery charger power: generic-adc-battery: check for duplicate properties copied from iio channels power: generic-adc-battery: fix out-of-bounds write when copying channel properties power: supply: axp288_charger: Fix initial constant_charge_current value power: supply: ab8500: stop using getnstimeofday64() power: gemini-poweroff: Avoid more spurious poweroffs power: vexpress: fix corruption in notifier registration power: remove possible deadlock when unregistering power_supply ...
| * \ \ \ Merge branch 'psy-fixes' into psy-nextSebastian Reichel2018-08-167-18/+46
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Signed-off-by: Sebastian Reichel <sre@kernel.org>
| | * | | | power: supply: max77693_charger: fix unintentional fall-throughGustavo A. R. Silva2018-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that a *break* is missing in order to avoid a fall-through. Otherwise, the calculation of *data* makes no sense. Addresses-Coverity-ID: 1271172 ("Missing break in switch") Fixes: 87c2d9067893 ("power: max77693: Add charger driver for Maxim 77693") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | | | power: generic-adc-battery: check for duplicate properties copied from iio ↵H. Nikolaus Schaller2018-07-061-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | channels If an iio channel defines a basic property, there are duplicate entries in /sys/class/power/*/uevent. So add a check to avoid duplicates. Since all channels may be duplicates, we have to modify the related error check. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Cc: stable@vger.kernel.org Fixes: e60fea794e6e ("power: battery: Generic battery driver using IIO") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | | | power: generic-adc-battery: fix out-of-bounds write when copying channel ↵H. Nikolaus Schaller2018-07-061-10/+4Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | properties We did have sporadic problems in the pinctrl framework during boot where a pin group name unexpectedly became NULL leading to a NULL dereference in strcmp. Detailled analysis of the failing cases did reveal that there were two devm allocated objects close to each other. The second one was the affected group_desc in pinmux and the first one was the psy_desc->properties buffer of the gab driver. Review of the gab code showed that the address calculation for one memcpy() is wrong. It does properties + sizeof(type) * index but C is defined to do the index multiplication already for pointer + integer additions. Hence the factor was applied twice and the memcpy() does write outside of the properties buffer. Sometimes it happened to be the pinctrl and triggered the strcmp(NULL). Anyways, it is overkill to use a memcpy() here instead of a simple assignment, which is easier to read and has less risk for wrong address calculations. So we change code to a simple assignment. If we initialize the index to the first free location, we can even remove the local variable 'properties'. This bug seems to exist right from the beginning in 3.7-rc1 in commit e60fea794e6e ("power: battery: Generic battery driver using IIO") Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Cc: stable@vger.kernel.org Fixes: e60fea794e6e ("power: battery: Generic battery driver using IIO") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
| | * | | | power: supply: axp288_charger: Fix initial constant_charge_current valueHans de Goede2018-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should look at val which contains the value read from the register, not ret which is always 0 on a successful read. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Fixes: eac53b3664f59 ("power: supply: axp288_charger: Drop platform_data dependency") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>