summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Stelmach <l.stelmach@samsung.com>2021-04-09 16:59:56 +0200
committerŁukasz Stelmach <l.stelmach@samsung.com>2021-04-19 09:58:52 +0200
commit81ece1261223efaba9b2e0227188d0c28f626c19 (patch)
treec8739e824162e5d12e02c37eeebe201faf43ff5a
parentef6082f2da28c879464f073b28eaf11a8105d174 (diff)
downloadlinux-rpi3-81ece1261223efaba9b2e0227188d0c28f626c19.tar.gz
linux-rpi3-81ece1261223efaba9b2e0227188d0c28f626c19.tar.bz2
linux-rpi3-81ece1261223efaba9b2e0227188d0c28f626c19.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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index fb6afb3f8dc6..67608e0ed421 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;
}