public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Salman Qazi <sqazi@google.com>,
	linux-kernel@vger.kernel.org,
	Nick Piggin <nickpiggin@yahoo.com.au>
Subject: Re: A bug in read operation for /dev/zero and a proposed fix.
Date: Thu, 4 Jun 2009 14:05:53 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.01.0906041405030.4880@localhost.localdomain> (raw)
In-Reply-To: <alpine.LFD.2.01.0906041355560.4880@localhost.localdomain>



On Thu, 4 Jun 2009, Linus Torvalds wrote:
> 
> If we want to do this for 2.6.30, though, I very much agree with the 
> notion of limiting it to just fatal signals, though.

IOW, I really think the patch should look like the following, and that 
this has nothing to do with OOM-killing at all.

		Linus
---
 drivers/char/mem.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 8f05c38..65e12bc 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -694,6 +694,9 @@ static ssize_t read_zero(struct file * file, char __user * buf,
 		written += chunk - unwritten;
 		if (unwritten)
 			break;
+		/* Consider changing this to just 'signal_pending()' with lots of testing */
+		if (fatal_signal_pending(current))
+			return written ? written : -EINTR;
 		buf += chunk;
 		count -= chunk;
 		cond_resched();

      reply	other threads:[~2009-06-04 21:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 20:32 A bug in read operation for /dev/zero and a proposed fix Salman Qazi
2009-06-04 20:50 ` Andrew Morton
2009-06-04 20:56   ` Salman Qazi
2009-06-04 21:01   ` Linus Torvalds
2009-06-04 21:05     ` Linus Torvalds [this message]

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.01.0906041405030.4880@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=sqazi@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