Commit Graph

637738 Commits

Author SHA1 Message Date
Daniel Rosenberg
1ec143333a ANDROID: sdcardfs: Fix gid issue
We were already calculating most of these values,
and erroring out because the check was confused by this.
Instead of recalculating, adjust it as needed.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 36160015
Change-Id: I9caf3e2fd32ca2e37ff8ed71b1d392f1761bc9a9
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
32dc587e60 ANDROID: sdcardfs: Remove uninformative prints
At best these prints do not provide useful information, and
at worst, some allow userspace to abuse the kernel log.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 36138424
Change-Id: I812c57cc6a22b37262935ab77f48f3af4c36827e
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
e2538dac6a ANDROID: sdcardfs: move path_put outside of spinlock
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35643557
Change-Id: Ib279ebd7dd4e5884d184d67696a93e34993bc1ef
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
a8c207863c ANDROID: sdcardfs: Use case insensitive hash function
Case insensitive comparisons don't help us much if
we hash to different buckets...

Signed-off-by: Daniel Rosenberg <drosen@google.com>
bug: 36004503
Change-Id: I91e00dbcd860a709cbd4f7fd7fc6d855779f3285
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
35ba5f63ae ANDROID: sdcardfs: declare MODULE_ALIAS_FS
From commit ee616b78aa87 ("Wrapfs: declare MODULE_ALIAS_FS")

Signed-off-by: Daniel Rosenberg <drosen@google.com>
bug: 35766959
Change-Id: Ia4728ab49d065b1d2eb27825046f14b97c328cba
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
3884c2e65b ANDROID: sdcardfs: Get the blocksize from the lower fs
This changes sdcardfs to be more in line with the
getattr in wrapfs, which calls the lower fs's getattr
to get the block size

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34723223
Change-Id: I1c9e16604ba580a8cdefa17f02dcc489d7351aed
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
64386edfcd ANDROID: sdcardfs: Use d_invalidate instead of drop_recurisve
drop_recursive did not properly remove stale dentries.
Instead, we use the vfs's d_invalidate, which does the proper cleanup.

Additionally, remove the no longer used drop_recursive, and
fixup_top_recursive that that are no longer used.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: Ibff61b0c34b725b024a050169047a415bc90f0d8
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
721274abc6 ANDROID: sdcardfs: Switch to internal case insensitive compare
There were still a few places where we called into a case
insensitive lookup that was not defined by sdcardfs.
Moving them all to the same place will allow us to switch
the implementation in the future.

Additionally, the check in fixup_perms_recursive did not
take into account the length of both strings, causing
extraneous matches when the name we were looking for was
a prefix of the child name.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I45ce768cd782cb4ea1ae183772781387c590ecc2
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
dae31f8134 ANDROID: sdcardfs: Use spin_lock_nested
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 36007653
Change-Id: I805d5afec797669679853fb2bb993ee38e6276e4
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
fb4d19169b ANDROID: sdcardfs: Replace get/put with d_lock
dput cannot be called with a spin_lock. Instead,
we protect our accesses by holding the d_lock.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35643557
Change-Id: I22cf30856d75b5616cbb0c223724f5ab866b5114
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
b434e57b38 ANDROID: sdcardfs: rate limit warning print
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35848445
Change-Id: Ida72ea0ece191b2ae4a8babae096b2451eb563f6
2017-03-21 12:46:53 -07:00
Daniel Rosenberg
fe0756d373 ANDROID: sdcardfs: Fix case insensitive lookup
The previous case insensitive lookup relied on the
entry being present in the dcache. This instead uses
iterate_dir to find the correct case.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
bug: 35633782
Change-Id: I556f7090773468c1943c89a5e2aa07f746ba49c5
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
85626b47bd ANDROID: sdcardfs: support direct-IO (DIO) operations
This comes from the wrapfs
commit 2e346c83b26e ("Wrapfs: support direct-IO (DIO) operations")

Signed-off-by: Li Mengyang <li.mengyang@stonybrook.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34133558
Change-Id: I3fd779c510ab70d56b1d918f99c20421b524cdc4
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
055fc87570 ANDROID: sdcardfs: implement vm_ops->page_mkwrite
This comes from wrapfs
commit 3dfec0ffe5e2 ("Wrapfs: implement vm_ops->page_mkwrite")

Some file systems (e.g., ext4) require it.  Reported by Ted Ts'o.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34133558
Change-Id: I1a389b2422c654a6d3046bb8ec3e20511aebfa8e
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
1df48421ee ANDROID: sdcardfs: Don't bother deleting freelist
There is no point deleting entries from dlist, as
that is a temporary list on the stack from which
contains only entries that are being deleted.

Not all code paths set up dlist, so those that
don't were performing invalid accesses in
hash_del_rcu. As an additional means to prevent
any other issue, we null out the list entries when
we allocate from the cache.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35666680
Change-Id: Ibb1e28c08c3a600c29418d39ba1c0f3db3bf31e5
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
f61bc5ac32 ANDROID: sdcardfs: Add missing path_put
"ANDROID: sdcardfs: Add GID Derivation to sdcardfs" introduced
an unbalanced pat_get, leading to storage space not being freed
after deleting a file until rebooting. This adds the missing path_put.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34691169
Change-Id: Ia7ef97ec2eca2c555cc06b235715635afc87940e
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
8e818ff05a ANDROID: sdcardfs: Fix incorrect hash
This adds back the hash calculation removed as part of
the previous patch, as it is in fact necessary.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35307857
Change-Id: Ie607332bcf2c5d2efdf924e4060ef3f576bf25dc
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
a28be72802 ANDROID: export security_path_chown
Signed-off-by: Daniel Rosenberg <drosen@google.com>
BUG: 35142419
Change-Id: I05a9430a3c1bc624e019055175ad377290b4e774
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
5004c5f31c ANDROID: sdcardfs: Switch strcasecmp for internal call
This moves our uses of strcasecmp over to an internal call so we can
easily change implementations later if we so desire. Additionally,
we leverage qstr's where appropriate to save time on comparisons.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I32fdc4fd0cd3b7b735dcfd82f60a2516fd8272a5
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
52b7768b27 ANDROID: sdcardfs: switch to full_name_hash and qstr
Use the kernel's string hash function instead of rolling
our own. Additionally, save a bit of calculation by using
the qstr struct in place of strings.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I0bbeb5ec2a9233f40135ad632e6f22c30ffa95c1
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
ad90525b8b ANDROID: sdcardfs: Add GID Derivation to sdcardfs
This changes sdcardfs to modify the user and group in the
underlying filesystem depending on its usage. Ownership is
set by Android user, and package, as well as if the file is
under obb or cache. Other files can be labeled by extension.
Those values are set via the configfs interace.

To add an entry,
mkdir -p [configfs root]/sdcardfs/extensions/[gid]/[ext]

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34262585
Change-Id: I4e030ce84f094a678376349b1a96923e5076a0f4
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
147f8ab2fd ANDROID: sdcardfs: Remove redundant operation
We call get_derived_permission_new unconditionally, so we don't need
to call update_derived_permission_lock, which does the same thing.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I0748100828c6af806da807241a33bf42be614935
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
d8caaf9d95 ANDROID: sdcardfs: add support for user permission isolation
This allows you to hide the existence of a package from
a user by adding them to an exclude list. If a user
creates that package's folder and is on the exclude list,
they will not see that package's id.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34542611
Change-Id: I9eb82e0bf2457d7eb81ee56153b9c7d2f6646323
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
f48ace1432 ANDROID: sdcardfs: Refactor configfs interface
This refactors the configfs code to be more easily extended.
It will allow additional files to be added easily.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 34542611
Bug: 34262585
Change-Id: I73c9b0ae5ca7eb27f4ebef3e6807f088b512d539
2017-03-21 12:46:52 -07:00
Daniel Rosenberg
83d1cad3a1 ANDROID: sdcardfs: Allow non-owners to touch
This modifies the permission checks in setattr to
allow for non-owners to modify the timestamp of
files to things other than the current time.
This still requires write access, as enforced by
the permission call, but relaxes the requirement
that the caller must be the owner, allowing those
with group permissions to change it as well.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 11118565
Change-Id: Ied31f0cce2797675c7ef179eeb4e088185adcbad
2017-03-21 12:46:52 -07:00
Martijn Coenen
8b451dc2bb ANDROID: binder: add padding to binder_fd_array_object.
binder_fd_array_object starts with a 4-byte header,
followed by a few fields that are 8 bytes when
ANDROID_BINDER_IPC_32BIT=N.

This can cause alignment issues in a 64-bit kernel
with a 32-bit userspace, as on x86_32 an 8-byte primitive
may be aligned to a 4-byte address. Pad with a __u32
to fix this.

Change-Id: I4374ed2cc3ccd3c6a1474cb7209b53ebfd91077b
Signed-off-by: Martijn Coenen <maco@android.com>
2017-03-21 17:41:50 +00:00
Martijn Coenen
872c26eb07 ANDROID: binder: use group leader instead of open thread
The binder allocator assumes that the thread that
called binder_open will never die for the lifetime of
that proc. That thread is normally the group_leader,
however it may not be. Use the group_leader instead
of current.

Bug: 35707103
Test: Created test case to open with temporary thread

Change-Id: Id693f74b3591f3524a8c6e9508e70f3e5a80c588
Signed-off-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Martijn Coenen <maco@android.com>
2017-03-21 17:41:40 +00:00
Jungseung Lee
a02c7541b7 BACKPORT: mmc: core: Export device lifetime information through sysfs
In the eMMC 5.0 version of the spec, several EXT_CSD fields about
device lifetime are added.

 - Two types of estimated indications reflected by averaged wear out of memory
 - An indication reflected by average reserved blocks

Export the information through sysfs.

Signed-off-by: Jungseung Lee <js07.lee@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-03-20 22:23:42 +00:00
Badhri Jagan Sridharan
9b7246ebf0 ANDROID: android-verity: do not compile as independent module
dm-android-verity depends on optional kernel command line parameters.
When compiled as module the __setup macro ends up being a no-op
resulting in the following warnings:

/work/build/batch/drivers/md/dm-android-verity.c:91:19: warning: 'verity_buildvariant' defined but not used [-Wunused-function]
 static int __init verity_buildvariant(char *line)
                   ^~~~~~~~~~~~~~~~~~~
/work/build/batch/drivers/md/dm-android-verity.c:83:19: warning: 'verity_keyid_param' defined but not used [-Wunused-function]
 static int __init verity_keyid_param(char *line)
                   ^~~~~~~~~~~~~~~~~~
/work/build/batch/drivers/md/dm-android-verity.c:75:19: warning: 'verity_mode_param' defined but not used [-Wunused-function]
 static int __init verity_mode_param(char *line)
                   ^~~~~~~~~~~~~~~~~
/work/build/batch/drivers/md/dm-android-verity.c:67:19: warning: 'verified_boot_state_param' defined but not used [-Wunused-function]
 static int __init verified_boot_state_param(char *line)
                   ^~~~~~~~~~~~~~~~~~~~~~~~~
Tested with allmodconfig.

Change-Id: Idfe0c97b216bb620cc7264e968b494eb3a765157
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
2017-03-20 15:06:35 -07:00
Todd Kjos
23b839a4ab resolve merge conflicts of 8fed8fc188 to android-4.4
Change-Id: I743e23d01785febb1e6285e8ebfcf80a488917c5
2017-03-20 09:15:32 -07:00
Sean Young
9ead931464 rc: raw decoder for keymap protocol is not loaded on register
am: 39df5977fd

Change-Id: I01431f5b64836454789cfb846c3a7c99a35cf771
2017-03-18 11:37:05 +00:00
Mikulas Patocka
04ab239838 dm: flush queued bios when process blocks to avoid deadlock
am: 21582cd0b6

Change-Id: I23e32d9f39d07a9a6178688aa78f7b0a10718408
2017-03-18 11:36:57 +00:00
Jintack Lim
f2b56a7662 KVM: arm/arm64: Let vcpu thread modify its own active state
am: d29e6215e5

Change-Id: Ie850ee7a02d3d66511b57b48eee7d80e03f630ad
2017-03-18 11:36:48 +00:00
Janosch Frank
8b551ea6ba KVM: s390: Fix guest migration for huge guests resulting in panic
am: 9d89c20f3b

Change-Id: I3a3b215e0e9254f87ccb05ee17a2bc7881fdd272
2017-03-18 11:36:38 +00:00
Krzysztof Kozlowski
06e68c07cd serial: samsung: Continue to work if DMA request fails
am: ce8ab5f168

Change-Id: I2ac930cd8593ea523462b1a1634951275d112daf
2017-03-18 11:36:29 +00:00
Johan Hovold
a0dd42a283 USB: serial: io_ti: fix information leak in completion handler
am: d0ef6ecee8

Change-Id: I982f042fae1fc32c79f2e2df0260dba3eadb25ae
2017-03-18 11:36:21 +00:00
Johan Hovold
3c522b5860 USB: serial: io_ti: fix NULL-deref in interrupt callback
am: 449b0bb237

Change-Id: If2459faa559e8d5963e9d149ca148819cfdaee6a
2017-03-18 11:36:11 +00:00
Johan Hovold
e082896be7 USB: iowarrior: fix NULL-deref in write
am: f06b17020a

Change-Id: I2ba9bd81a176394bdf8b43e2e0fa77eca0e90ab2
2017-03-18 11:36:02 +00:00
Johan Hovold
6c0dcf8695 USB: iowarrior: fix NULL-deref at probe
am: 653418adaf

Change-Id: I1345deaf740389416299a5d772b8c313baa4ef6d
2017-03-18 11:35:53 +00:00
Johan Hovold
912a046e77 USB: serial: omninet: fix reference leaks at open
am: 6d6c5895f4

Change-Id: I305e7244ba3e9f6ad4519d38163be81938dc4a7a
2017-03-18 11:35:45 +00:00
Johan Hovold
6a85adbea5 USB: serial: safe_serial: fix information leak in completion handler
am: 0ab90ddba7

Change-Id: Id1d59a85bcec9ebc9a7307843c5cfd70179d9a59
2017-03-18 11:35:36 +00:00
Guenter Roeck
384a102db6 usb: host: xhci-plat: Fix timeout on removal of hot pluggable xhci controllers
am: 24db1c5a1c

Change-Id: I90e3e3aea8ae3d7a3e25067039815fe87c421a9b
2017-03-18 11:35:28 +00:00
Peter Chen
6aabbf668d usb: host: xhci-dbg: HCIVERSION should be a binary number
am: d863767907

Change-Id: I7d5c0b69905a4f53c9ab2a0001d5bb615d723ec0
2017-03-18 11:35:19 +00:00
Roger Quadros
bc1d6eb5d0 Revert "usb: gadget: uvc: Add missing call for additional setup data"
am: 03123df08e

Change-Id: Ica069c59aaddb9d6fe21218e873f9963cbeb57d0
2017-03-18 11:35:10 +00:00
Felipe Balbi
b35506702c usb: gadget: function: f_fs: pass companion descriptor along
am: 5ce2e4ce4a

Change-Id: Id9a3ad5a46abd4c67239369f79a7f3bef4a6124e
2017-03-18 11:35:01 +00:00
Jelle Martijn Kok
4e9e3bbf88 usb: ohci-at91: Do not drop unhandled USB suspend control requests
am: 40192c9666

Change-Id: I33901103122b32cfb69af983456ba1666e791d94
2017-03-18 11:34:52 +00:00
Roger Quadros
4709f3ee23 usb: dwc3-omap: Fix missing break in dwc3_omap_set_mailbox()
am: accadd8164

Change-Id: Ifdb587bf137b1154495b47aebae8760aed2cf060
2017-03-18 11:34:42 +00:00
Felipe Balbi
b8faeb2d45 usb: dwc3: gadget: make Set Endpoint Configuration macros safe
am: 808ee146d7

Change-Id: I63d636f62f55d12407c8423c10b3924e52b62e62
2017-03-18 11:34:33 +00:00
Peter Chen
9234bb51d0 usb: gadget: dummy_hcd: clear usb_gadget region before registration
am: de90394b0c

Change-Id: I376b8c03eb0d948434745c667067549b44b9dde2
2017-03-18 11:34:23 +00:00
Ethan Zhao
7298ebf711 PCI: Prevent VPD access for QLogic ISP2722
am: ed99f5a09c

Change-Id: I58f0f9ec91795e325983ec5baecda4580459344a
2017-03-18 11:34:13 +00:00