mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiong Zhou <jencce.kernel@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-team@android.com, nnk@google.com, john.stultz@linaro.org,
	gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	jencce.kernel@gmail.com, arnd@arndb.de
Subject: [PATCH] staging: android: logger: fix kuid/uid in logger_entry
Date: Thu, 30 Oct 2014 10:23:31 +0800 (CST)	[thread overview]
Message-ID: <alpine.LFD.2.11.1410301007090.3316@dhcp12-144.nay.redhat.com> (raw)

From: Xiong Zhou <jencce.kernel@gmail.com>

struct logger_entry can be returned to userspace via ioctl,
so it is wrong to have a kuid_t member, fixing it to uid_t.
This was introduced by commit bd471258f2, to pass uidguid
type checks : UIDGID_STRICT_TYPE_CHECKS, which has been
removed from kernel in commit 261000a56b6.

Fixes: bd471258f2 (logger: use kuid_t instead of uid_t)
Signed-off-by: Xiong Zhou <jencce.kernel@gmail.com>
---
  drivers/staging/android/logger.c | 4 ++--
  drivers/staging/android/logger.h | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 28b93d3..fb06bf2 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -252,7 +252,7 @@ static size_t get_next_entry_by_uid(struct logger_log *log,

  		entry = get_entry_header(log, off, &scratch);

-		if (uid_eq(entry->euid, euid))
+		if (entry->euid == __kuid_val(euid))
  			return off;

  		next_len = sizeof(struct logger_entry) + entry->len;
@@ -430,7 +430,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from)
  	header.tid = current->pid;
  	header.sec = now.tv_sec;
  	header.nsec = now.tv_nsec;
-	header.euid = current_euid();
+	header.euid = __kuid_val(current_euid());
  	header.len = count;
  	header.hdr_size = sizeof(struct logger_entry);

diff --git a/drivers/staging/android/logger.h b/drivers/staging/android/logger.h
index 70af7d8..cc6bbd9 100644
--- a/drivers/staging/android/logger.h
+++ b/drivers/staging/android/logger.h
@@ -66,7 +66,7 @@ struct logger_entry {
  	__s32		tid;
  	__s32		sec;
  	__s32		nsec;
-	kuid_t		euid;
+	uid_t		euid;
  	char		msg[0];
  };

-- 
1.9.3


             reply	other threads:[~2014-10-30  2:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  2:23 Xiong Zhou [this message]
2014-10-30  7:04 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.11.1410301007090.3316@dhcp12-144.nay.redhat.com \
    --to=jencce.kernel@gmail.com \
    --cc=arnd@arndb.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nnk@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®