public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Hello. Patch time (drivers/block/loop.c)
@ 2001-12-22  8:14 Eric Windisch
  2001-12-22  8:29 ` Andreas Dilger
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Windisch @ 2001-12-22  8:14 UTC (permalink / raw)
  To: linux-kernel

[-- 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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hello. Patch time (drivers/block/loop.c)
  2001-12-22  8:14 Hello. Patch time (drivers/block/loop.c) Eric Windisch
@ 2001-12-22  8:29 ` Andreas Dilger
  2001-12-22  8:37   ` Eric Windisch
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Dilger @ 2001-12-22  8:29 UTC (permalink / raw)
  To: linux-kernel

On Dec 22, 2001  03:14 -0500, Eric Windisch wrote:
> 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;

Contact Neil Brown, as this is already done.  That is a "feature" of
Linux - most things you want to do have already been done by someone
else.

> I think it would be really neat if the software-raid could eventually
> become compatable with hardware raid.. although much slower

In many cases, software raid is as fast or faster than hardware raid.
What do you mean by "compatible"?

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hello. Patch time (drivers/block/loop.c)
  2001-12-22  8:29 ` Andreas Dilger
@ 2001-12-22  8:37   ` Eric Windisch
  2001-12-22  8:51     ` Eric Windisch
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Windisch @ 2001-12-22  8:37 UTC (permalink / raw)
  To: linux-kernel

On Sat, Dec 22, 2001 at 01:29:34AM -0700, Andreas Dilger wrote:
> Contact Neil Brown, as this is already done.  That is a "feature" of
> Linux - most things you want to do have already been done by someone
> else.

I will look into that, do you have a url or email address (otherwise I'll use google or RTFM)?

> 
> > I think it would be really neat if the software-raid could eventually
> > become compatable with hardware raid.. although much slower
> 
> In many cases, software raid is as fast or faster than hardware raid.
> What do you mean by "compatible"?

Well, it would be nice if I could easily replace a raid controller with software raid.. if this could be possible, I assume it could be.

--
Eric Windisch
http://bwbohh.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Hello. Patch time (drivers/block/loop.c)
  2001-12-22  8:37   ` Eric Windisch
@ 2001-12-22  8:51     ` Eric Windisch
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Windisch @ 2001-12-22  8:51 UTC (permalink / raw)
  To: linux-kernel

On Sat, Dec 22, 2001 at 03:37:22AM -0500, Eric Windisch wrote:
> On Sat, Dec 22, 2001 at 01:29:34AM -0700, Andreas Dilger wrote:
> > Contact Neil Brown, as this is already done.  That is a "feature" of
> > Linux - most things you want to do have already been done by someone
> > else.
> 
> I will look into that, do you have a url or email address (otherwise I'll use google or RTFM)?
> 

Actually, I went ahead and RTFM.. I found the patch, thanks! :)

--
Eric Windisch
http://bwbohh.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-12-22  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-22  8:14 Hello. Patch time (drivers/block/loop.c) Eric Windisch
2001-12-22  8:29 ` Andreas Dilger
2001-12-22  8:37   ` Eric Windisch
2001-12-22  8:51     ` Eric Windisch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox