Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 52212 Details for
Bug 83425
ndiswrapper 1.0 leak patch
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Parak's Patch
ndis.c.patch (text/plain), 2.39 KB, created by
Karol Krizka
on 2005-02-26 18:19:17 UTC
(
hide
)
Description:
Parak's Patch
Filename:
MIME Type:
Creator:
Karol Krizka
Created:
2005-02-26 18:19:17 UTC
Size:
2.39 KB
patch
obsolete
>--- driver/ndis.c.orig 2005-02-20 23:14:58.000000000 -0500 >+++ driver/ndis.c 2005-02-21 10:54:15.000000000 -0500 >@@ -22,6 +22,7 @@ > #include <linux/types.h> > #include <linux/string.h> > #include <linux/ctype.h> >+#include <linux/list.h> > > #include "ndis.h" > #include "iw_ndis.h" >@@ -1045,6 +1046,15 @@ > TRACEEXIT3(return); > } > >+struct virt_mem_map { >+ struct list_head list; >+ void* virt; >+ void* buffer; >+}; >+typedef struct virt_mem_map virt_mem_map; >+ >+static LIST_HEAD(map_list); >+ > STDCALL void WRAP_EXPORT(NdisAllocateBufferPool) > (NDIS_STATUS *status, void *poolhandle, UINT size) > { >@@ -1064,7 +1074,27 @@ > (NDIS_STATUS *status, ndis_buffer **buffer, > void *poolhandle, void *virt, UINT len) > { >- ndis_buffer *buf = kmalloc(sizeof(ndis_buffer), GFP_ATOMIC); >+ struct list_head *tmp; >+ ndis_buffer *buf; >+ if(list_empty(&map_list)) { >+ goto doalloc; >+ } >+ list_for_each(tmp, &map_list){ >+ struct virt_mem_map* map = list_entry(tmp, struct virt_mem_map, list); >+ if(map->virt == virt) { >+ buf = (ndis_buffer*) map->buffer; >+ memset(buf, 0, sizeof(ndis_buffer)); >+ buf->startva = virt; >+ buf->byteoffset = 0; >+ buf->bytecount = len; >+ buf->next = NULL; >+ *buffer = buf; >+ *status = NDIS_STATUS_SUCCESS; >+ return; >+ } >+ } >+doalloc: >+ buf = kmalloc(sizeof(ndis_buffer), GFP_ATOMIC); > TRACEENTER4("%s", ""); > if (!buf) { > ERROR("%s", "Couldn't allocate memory"); >@@ -1080,6 +1110,20 @@ > buf->next = NULL; > > *buffer = buf; >+ >+ { >+ virt_mem_map *new_entry = kmalloc(sizeof(struct virt_mem_map), GFP_ATOMIC); >+ if(!new_entry) { >+ ERROR("%s", "Couldn't allocate memory"); >+ *status = NDIS_STATUS_FAILURE; >+ TRACEEXIT4(return); >+ } >+ INIT_LIST_HEAD(&new_entry->list); >+ new_entry->virt = virt; >+ new_entry->buffer = buf; >+ list_add(&new_entry->list, &map_list); >+ } >+ > > DBGTRACE4("allocated buffer: %p", buf); > *status = NDIS_STATUS_SUCCESS; >@@ -1089,10 +1133,20 @@ > STDCALL void WRAP_EXPORT(NdisFreeBuffer) > (ndis_buffer *buffer) > { >+ struct list_head *tmp; > TRACEENTER4("%p", buffer); >+ if (buffer) { >+ list_for_each(tmp, &map_list){ >+ struct virt_mem_map* map = list_entry(tmp, struct virt_mem_map, list); >+ if(map->buffer == buffer) { >+ list_del(&map->list); >+ kfree(map->buffer); >+ kfree(map); >+ return; >+ } >+ } > >- if (buffer) >- kfree(buffer); >+ } > TRACEEXIT4(return); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 83425
: 52212