The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Bill Davidsen <davidsen@tmr.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Jesper Juhl <juhl-lkml@dif.dk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Gadi Oxman <gadio@netvision.net.il>, Jens Axboe <axboe@suse.de>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH][2/2] ide-tape: small cleanups - handle   copy_to|from_user() failures
Date: Mon, 29 Nov 2004 17:47:10 -0500	[thread overview]
Message-ID: <41ABA6EE.6080502@tmr.com> (raw)
In-Reply-To: <1101663266.16761.43.camel@localhost.localdomain>

Alan Cox wrote:
> On Sul, 2004-11-28 at 16:32, Jesper Juhl wrote:
> 
>> #endif /* IDETAPE_DEBUG_BUGS */
>> 		count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n);
>>-		copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count);
>>+		if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count))
>>+			return -EFAULT;
>> 		n -= count;
>> 		atomic_add(count, &bh->b_count);
>> 		buf += count;
> 
> 
> If you do this then you don't fix up tape->bh for further operations.
> Have you tested these changes including the I/O errors ?

But (a) do you have enough information to backout or fixup correctly? 
And (b) won't this result in the whole i/o being treated as invalid?

-- 
    -bill davidsen (davidsen@tmr.com)
"The secret to procrastination is to put things off until the
  last possible moment - but no longer"  -me


  parent reply	other threads:[~2004-11-29 22:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-28 16:32 [PATCH][2/2] ide-tape: small cleanups - handle copy_to|from_user() failures Jesper Juhl
2004-11-28 17:34 ` Alan Cox
2004-11-28 19:39   ` Jesper Juhl
2004-11-28 21:16     ` Jesper Juhl
2004-11-29 22:47   ` Bill Davidsen [this message]
2004-11-29 23:23     ` Jesper Juhl
2004-11-30 12:03       ` Alan Cox

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=41ABA6EE.6080502@tmr.com \
    --to=davidsen@tmr.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@suse.de \
    --cc=gadio@netvision.net.il \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-kernel@vger.kernel.org \
    /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