summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-03-05 21:48:25 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-05 21:48:25 +0000
commitfcf1689c1a1654cb3b480356a1ba3ebf198f2943 (patch)
treeec5a11616a3370e8ef4e6c3908bf09b223d17af5 /cmds
parent69a141e07fab2672cf2cc23dcc124c46995fbf98 (diff)
parent5fec79156d749322dcc0376da1d6cf4d9ee9ccf4 (diff)
downloadframeworks_native-fcf1689c1a1654cb3b480356a1ba3ebf198f2943.zip
frameworks_native-fcf1689c1a1654cb3b480356a1ba3ebf198f2943.tar.gz
frameworks_native-fcf1689c1a1654cb3b480356a1ba3ebf198f2943.tar.bz2
am 5fec7915: Merge "service_manager: reorder permission checks for find"
* commit '5fec79156d749322dcc0376da1d6cf4d9ee9ccf4': service_manager: reorder permission checks for find
Diffstat (limited to 'cmds')
-rw-r--r--cmds/servicemanager/service_manager.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/cmds/servicemanager/service_manager.c b/cmds/servicemanager/service_manager.c
index f37427a..df46a60 100644
--- a/cmds/servicemanager/service_manager.c
+++ b/cmds/servicemanager/service_manager.c
@@ -169,28 +169,26 @@ uint16_t svcmgr_id[] = {
uint32_t do_find_service(struct binder_state *bs, const uint16_t *s, size_t len, uid_t uid, pid_t spid)
{
- struct svcinfo *si;
+ struct svcinfo *si = find_svc(s, len);
- if (!svc_can_find(s, len, spid)) {
- ALOGE("find_service('%s') uid=%d - PERMISSION DENIED\n",
- str8(s, len), uid);
+ if (!si || !si->handle) {
return 0;
}
- si = find_svc(s, len);
- //ALOGI("check_service('%s') handle = %x\n", str8(s, len), si ? si->handle : 0);
- if (si && si->handle) {
- if (!si->allow_isolated) {
- // If this service doesn't allow access from isolated processes,
- // then check the uid to see if it is isolated.
- uid_t appid = uid % AID_USER;
- if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END) {
- return 0;
- }
+
+ if (!si->allow_isolated) {
+ // If this service doesn't allow access from isolated processes,
+ // then check the uid to see if it is isolated.
+ uid_t appid = uid % AID_USER;
+ if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END) {
+ return 0;
}
- return si->handle;
- } else {
+ }
+
+ if (!svc_can_find(s, len, spid)) {
return 0;
}
+
+ return si->handle;
}
int do_add_service(struct binder_state *bs,