From: Oleg Nesterov <oleg@redhat.com>
To: arve@android.com, gregkh@suse.de, jrm8005@gmail.com,
rlove@google.com, swetland@google.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] android: task_get_unused_fd_flags: fix the wrong usage of tsk->signal
Date: Sun, 18 Jan 2009 18:17:20 +0100 [thread overview]
Message-ID: <20090118171720.GA18374@redhat.com> (raw)
Compile tested.
task_struct->signal is not protected by RCU, the code is bogus.
Change the code to take ->siglock to pin ->signal.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
--- CUR/drivers/staging/android/binder.c~ANDROID 2009-01-12 23:07:43.000000000 +0100
+++ CUR/drivers/staging/android/binder.c 2009-01-18 18:06:12.000000000 +0100
@@ -319,6 +319,7 @@ int task_get_unused_fd_flags(struct task
int fd, error;
struct fdtable *fdt;
unsigned long rlim_cur;
+ unsigned long irqs;
if (files == NULL)
return -ESRCH;
@@ -335,12 +336,11 @@ repeat:
* N.B. For clone tasks sharing a files structure, this test
* will limit the total number of files that can be opened.
*/
- rcu_read_lock();
- if (tsk->signal)
+ rlim_cur = 0;
+ if (lock_task_sighand(tsk, &irqs)) {
rlim_cur = tsk->signal->rlim[RLIMIT_NOFILE].rlim_cur;
- else
- rlim_cur = 0;
- rcu_read_unlock();
+ unlock_task_sighand(tsk, &irqs);
+ }
if (fd >= rlim_cur)
goto out;
next reply other threads:[~2009-01-18 17:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-18 17:17 Oleg Nesterov [this message]
2009-01-18 18:22 ` [PATCH] android: task_get_unused_fd_flags: fix the wrong usage of tsk->signal Greg KH
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=20090118171720.GA18374@redhat.com \
--to=oleg@redhat.com \
--cc=arve@android.com \
--cc=gregkh@suse.de \
--cc=jrm8005@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rlove@google.com \
--cc=swetland@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.