From: Markus Lidel <Markus.Lidel@shadowconnect.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.6] to fix i2o_proc kernel panic on access of /proc/i2o/iop0/lct
Date: Sat, 08 May 2004 13:33:47 +0200 [thread overview]
Message-ID: <409CC59B.3020500@shadowconnect.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
Hello,
the patch fixes a bug in the i2o_proc.c module, where the kernel panics,
if you access /proc/i2o/iop0/lct and read more then 1024 bytes of it.
The problem was, that no paging was implemented by the function. This is
now solved.
If you have any questions, pleese feel free to contact me.
Best regards,
Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)
Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany
Phone: +49 82 82/99 51-0
Fax: +49 82 82/99 51-11
E-Mail: Markus.Lidel@shadowconnect.com
URL: http://www.shadowconnect.com
[-- Attachment #2: i2o_proc-lct-access-bugfix.patch --]
[-- Type: text/x-patch, Size: 1215 bytes --]
--- a/drivers/message/i2o/i2o_proc.c 2004-04-04 05:37:25.000000000 +0200
+++ b/drivers/message/i2o/i2o_proc.c 2004-05-07 03:33:45.136253576 +0200
@@ -406,13 +406,15 @@
return len;
}
-int i2o_proc_read_lct(char *buf, char **start, off_t offset, int len,
+int i2o_proc_read_lct(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct i2o_controller *c = (struct i2o_controller*)data;
i2o_lct *lct = (i2o_lct *)c->lct;
int entries;
int i;
+ int len;
+ char *buf;
#define BUS_TABLE_SIZE 3
static char *bus_ports[] =
@@ -422,11 +424,13 @@
"Fibre Channel Bus"
};
- spin_lock(&i2o_proc_lock);
- len = 0;
-
entries = (lct->table_size - 3)/9;
+ buf = kmalloc(entries * 300 + 100, GFP_KERNEL);
+ if(!buf)
+ return -ENOMEM;
+ len = 0;
+
len += sprintf(buf, "LCT contains %d %s\n", entries,
entries == 1 ? "entry" : "entries");
if(lct->boot_tid)
@@ -538,7 +542,20 @@
lct->lct_entry[i].device_flags);
}
- spin_unlock(&i2o_proc_lock);
+ *start = page;
+
+ if(off > len) {
+ *eof = 1;
+ len = 0;
+ } else {
+ len -= off;
+ if(len <= count)
+ *eof = 1;
+ else
+ len = count;
+ }
+ strncpy(page, buf + off, len);
+ kfree(buf);
return len;
}
next reply other threads:[~2004-05-08 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-08 11:33 Markus Lidel [this message]
2004-05-08 15:39 ` [PATCH 2.6] to fix i2o_proc kernel panic on access of /proc/i2o/iop0/lct Ingo Oeser
2004-05-09 3:34 ` Markus Lidel
2004-05-09 13:08 ` Warren Togami
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=409CC59B.3020500@shadowconnect.com \
--to=markus.lidel@shadowconnect.com \
--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