lkml.org 
[lkml]   [2006]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Slab corruption after unloading a module
Date
> On Tue, 2006-04-18 at 10:08 +1200, zhiyi huang wrote:
>>>
>>>> There was no problem if I just load and unload the module. But if I
>>>> write to the device using "ls > /dev/temp" and then unload the
>>>> module, I would get slab corruption.
>>>
>>> you return different value as what has really been consumed:
>>>
>>>> if (*f_pos + count > MAX_DSIZE)
>>>> count1 = MAX_DSIZE - *f_pos;
>>>>
>>>> if (copy_from_user (temp_dev->data+*f_pos, buf, count1)) {
>
> this is still buggy.. what if f_pos is huge???

Well, if you look at my program, the complete code is like this:

if (*f_pos > MAX_DSIZE)
goto wrap_up;
if (*f_pos + count > MAX_DSIZE)
count1 = MAX_DSIZE - *f_pos;

if (copy_from_user (temp_dev->data+*f_pos, buf, count1)) {

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-04-18 00:25    [W:0.031 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site