All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Windisch <ericw@grokthis.net>
To: linux-kernel@vger.kernel.org
Subject: Hello. Patch time (drivers/block/loop.c)
Date: Sat, 22 Dec 2001 03:14:42 -0500	[thread overview]
Message-ID: <20011222031442.A25275@grokthis.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 891 bytes --]


Hello. I would like to formally introduce myself to this list, as this is my first post. Of course, I would not come to the table empty handed.. I bring to you a patch ;)

I was digging around the loopback block device driver and it wasn't long before I realized that it assumes you are writing if you are not reading.. which I assume could be hazardous if there is an overflow, bad memory, or someone modifies some other code without knowledge :)

Patch attached.

I may be looking at this and the multi-device drivers in the near future as I have a need for support for partitions on these devices; I think it would be really neat if the software-raid could eventually become compatable with hardware raid.. although much slower, it may be a nice thing to have for testing purposes or a last resort for those who fry their hardware raid-controllers ;)

--
Eric Windisch
http://bwbohh.net

[-- Attachment #2: loop-badmem.diff --]
[-- Type: text/plain, Size: 636 bytes --]

--- linux/drivers/block/loop.c	Fri Dec 21 12:41:53 2001
+++ linux-2.4.17-ericw/drivers/block/loop.c	Sat Dec 22 02:35:17 2001
@@ -90,8 +90,10 @@
 	if (raw_buf != loop_buf) {
 		if (cmd == READ)
 			memcpy(loop_buf, raw_buf, size);
-		else
+		else if (cmd == WRITE) 
 			memcpy(raw_buf, loop_buf, size);
+		else
+			printk(KERN_ERR "loop: Illegal command, %d", cmd);
 	}
 
 	return 0;
@@ -106,9 +108,11 @@
 	if (cmd == READ) {
 		in = raw_buf;
 		out = loop_buf;
-	} else {
+	} else if (cmd == WRITE) {
 		in = loop_buf;
 		out = raw_buf;
+	} else {
+		printk(KERN_ERR "loop: Illegal command, %d", cmd);
 	}
 
 	key = lo->lo_encrypt_key;

             reply	other threads:[~2001-12-22  8:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-22  8:14 Eric Windisch [this message]
2001-12-22  8:29 ` Hello. Patch time (drivers/block/loop.c) Andreas Dilger
2001-12-22  8:37   ` Eric Windisch
2001-12-22  8:51     ` Eric Windisch

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=20011222031442.A25275@grokthis.net \
    --to=ericw@grokthis.net \
    --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 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.