resending - mistakenly used the owner-lkcd address in the previous attempt
...
I ran into a few problems with drivers/block/dump.c when compiling it into
the kernel.
1) dump_in_progress is initialized both in drivers/block/dump.c and
kernel/panic.c. I think the reference in /block/dump.c should be declared as
an extern.
2) RDWR permission check is not required for query ioctls.
3) The calls to dump_compress_rle_init (and dump_compress_gzip_init, if it
was usable) in dump.c result in double registration and a corrupted
dump_compress_list. This happens because module_init in dump_rle.c becomes
either an __initcall() or a init_module() and is automatically called by the
kernel whether it's configured as a module or not.
Here's a patch with fixes for the above changes
--- 2.4/drivers/block/dump.c Mon Sep 17 12:00:14 2001
+++ 2.4fix/linux/drivers/block/dump.c Fri Sep 21 11:07:59 2001
@@ -211,9 +211,9 @@
char dumpdev_name[PATH_MAX]; /* the name of the dump device
*/
void *dump_page_buf; /* dump page buffer for memcpy()!
*/
int dump_sector_size; /* sector size for dump_device
*/
int dump_sector_bits; /* sector bits for dump_device
*/
-int dump_in_progress = FALSE; /* when we're dumping, we're dumping
*/
+extern int dump_in_progress; /* when we're dumping, we're dumping
*/
dump_header_t dump_header; /* the primary dump header
*/
dump_header_asm_t dump_header_asm; /* the arch-specific dump header
*/
struct kiobuf *dump_iobuf; /* kiobuf for raw I/O to disk
*/
loff_t dump_fpos; /* the offset in the output device
*/
@@ -1132,11 +1132,17 @@
if (!capable(CAP_SYS_ADMIN)) {
return (-EPERM);
}
- /* check flags */
- if (!(f->f_flags & O_RDWR)) {
- return (-EPERM);
+ switch (cmd) {
+ case DIOSDUMPDEV:
+ case DIOSDUMPLEVEL:
+ case DIOSDUMPFLAGS:
+ case DIOSDUMPCOMPRESS:
+ /* check flags */
+ if (!(f->f_flags & O_RDWR)) {
+ return (-EPERM);
+ }
}
/*
* This is the main mechanism for controlling get/set data
@@ -1325,16 +1331,8 @@
/* set the dump_compression_list structure up */
dump_compress = DUMP_COMPRESS_NONE;
dump_compress_func = dump_compress_none;
dump_register_compression(&dump_none_compression);
-
-#if CONFIG_DUMP_COMPRESS_RLE
- (void)dump_compress_rle_init();
-#endif
-
-#if CONFIG_DUMP_COMPRESS_GZIP
- (void)dump_compress_gzip_init();
-#endif
/* initialize the dump flags, dump level and dump_compress fields */
dump_flags = DUMP_FLAGS_NONE;
dump_level = DUMP_LEVEL_ALL;
Monty VanderBilt
mvb@xxxxxxxxxx
|