diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-02-02 09:20:31 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-02-03 15:09:20 -0800 |
commit | 53c0ca6520528f53aa9ed3368e5c6fcbd3152851 (patch) | |
tree | 9b1948152b5cef18bf46db70fb320516f0a4d421 | |
parent | e37111d7516827489232c6c894e114a58952fe4a (diff) | |
download | core-53c0ca6520528f53aa9ed3368e5c6fcbd3152851.tar.gz core-53c0ca6520528f53aa9ed3368e5c6fcbd3152851.tar.bz2 core-53c0ca6520528f53aa9ed3368e5c6fcbd3152851.zip |
libcutils: abort for invalid fd
If ashmem accessors are being called with a file descriptor that
belongs to anything other than ashmem, we need to stop it right
now so that they can fix the caller.
Bug: 26871259
Change-Id: Icf9aafc3631a80b9af6fe0fea03599d61e285d21
-rw-r--r-- | libcutils/ashmem-dev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libcutils/ashmem-dev.c b/libcutils/ashmem-dev.c index d6a48c953..4a07d66bb 100644 --- a/libcutils/ashmem-dev.c +++ b/libcutils/ashmem-dev.c @@ -118,15 +118,16 @@ static int __ashmem_is_ashmem(int fd) } if (rdev) { - ALOGE("illegal fd=%d mode=0%o rdev=%d:%d expected 0%o %d:%d", + LOG_ALWAYS_FATAL("illegal fd=%d mode=0%o rdev=%d:%d expected 0%o %d:%d", fd, st.st_mode, major(st.st_rdev), minor(st.st_rdev), S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IRGRP, major(rdev), minor(rdev)); } else { - ALOGE("illegal fd=%d mode=0%o rdev=%d:%d expected 0%o", + LOG_ALWAYS_FATAL("illegal fd=%d mode=0%o rdev=%d:%d expected 0%o", fd, st.st_mode, major(st.st_rdev), minor(st.st_rdev), S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IRGRP); } + /* NOTREACHED */ errno = ENOTTY; return -1; |