diff options
author | Łukasz Stelmach <l.stelmach@samsung.com> | 2021-04-09 16:59:56 +0200 |
---|---|---|
committer | Karol Lewandowski <k.lewandowsk@samsung.com> | 2021-04-22 15:19:13 +0200 |
commit | 820396b93ae48680dd536704be80809b52f1639e (patch) | |
tree | d1b78fe459cee2dd4b71e8d37819f3f47f7b2f41 | |
parent | bd7484017b772ec4fec2e75477df361ff6d1d29c (diff) | |
download | linux-tizen-modules-820396b93ae48680dd536704be80809b52f1639e.tar.gz linux-tizen-modules-820396b93ae48680dd536704be80809b52f1639e.tar.bz2 linux-tizen-modules-820396b93ae48680dd536704be80809b52f1639e.zip |
logger: adapt access mode checks
Allow setting the tag and the priority only for files opened O_WRONLY.
Change-Id: Icc9d7a8eb96f8f1b1aa00717aae1f32f7a2e52e4
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
-rw-r--r-- | drivers/staging/android/logger.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index fb6afb3..67608e0 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c @@ -957,7 +957,8 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = logger_set_version(reader, argp); break; case LOGGER_SET_PRIO: /* 44552 */ - if (file->f_mode & FMODE_READ) { + if ((file->f_mode & FMODE_READ) || + !(file->f_mode & FMODE_WRITE)) { ret = -EBADF; break; } @@ -965,7 +966,8 @@ static long logger_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ret = logger_set_prio(writer, argp); break; case LOGGER_SET_TAG: /* 44551 */ - if (file->f_mode & FMODE_READ) { + if ((file->f_mode & FMODE_READ) || + !(file->f_mode & FMODE_WRITE)) { ret = -EBADF; break; } |