Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3c5844f3
Commit
3c5844f3
authored
May 01, 2003
by
Dave Jones
Committed by
Dave Jones
May 01, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AGPGART] Bulletproofing. NULL ptrs after freeing them.
parent
628c89f7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/amd-k7-agp.c
+1
-0
drivers/char/agp/backend.c
drivers/char/agp/backend.c
+6
-2
drivers/char/agp/frontend.c
drivers/char/agp/frontend.c
+12
-14
drivers/char/agp/generic.c
drivers/char/agp/generic.c
+6
-1
No files found.
drivers/char/agp/amd-k7-agp.c
View file @
3c5844f3
...
...
@@ -75,6 +75,7 @@ static void amd_free_gatt_pages(void)
}
}
kfree
(
tables
);
amd_irongate_private
.
gatt_pages
=
NULL
;
}
static
int
amd_create_gatt_pages
(
int
nr_tables
)
...
...
drivers/char/agp/backend.c
View file @
3c5844f3
...
...
@@ -185,8 +185,10 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge)
phys_to_virt
(
bridge
->
scratch_page_real
));
if
(
got_gatt
)
bridge
->
driver
->
free_gatt_table
();
if
(
got_keylist
)
if
(
got_keylist
)
{
vfree
(
bridge
->
key_list
);
bridge
->
key_list
=
NULL
;
}
return
rc
;
}
...
...
@@ -197,8 +199,10 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
bridge
->
driver
->
cleanup
();
if
(
bridge
->
driver
->
free_gatt_table
)
bridge
->
driver
->
free_gatt_table
();
if
(
bridge
->
key_list
)
if
(
bridge
->
key_list
)
{
vfree
(
bridge
->
key_list
);
bridge
->
key_list
=
NULL
;
}
if
(
bridge
->
driver
->
agp_destroy_page
&&
bridge
->
driver
->
needs_scratch_page
)
...
...
drivers/char/agp/frontend.c
View file @
3c5844f3
...
...
@@ -198,6 +198,7 @@ static int agp_create_segment(agp_client * client, agp_region * region)
seg
=
kmalloc
((
sizeof
(
agp_segment_priv
)
*
region
->
seg_count
),
GFP_KERNEL
);
if
(
seg
==
NULL
)
{
kfree
(
region
->
seg_list
);
region
->
seg_list
=
NULL
;
return
-
ENOMEM
;
}
memset
(
seg
,
0
,
(
sizeof
(
agp_segment_priv
)
*
region
->
seg_count
));
...
...
@@ -208,14 +209,15 @@ static int agp_create_segment(agp_client * client, agp_region * region)
seg
[
i
].
pg_count
=
user_seg
[
i
].
pg_count
;
seg
[
i
].
prot
=
agp_convert_mmap_flags
(
user_seg
[
i
].
prot
);
}
kfree
(
region
->
seg_list
);
region
->
seg_list
=
NULL
;
ret_seg
=
kmalloc
(
sizeof
(
void
*
),
GFP_KERNEL
);
if
(
ret_seg
==
NULL
)
{
kfree
(
region
->
seg_list
);
kfree
(
seg
);
return
-
ENOMEM
;
}
*
ret_seg
=
seg
;
kfree
(
region
->
seg_list
);
agp_add_seg_to_client
(
client
,
ret_seg
,
region
->
seg_count
);
return
0
;
}
...
...
@@ -690,6 +692,7 @@ static int agp_release(struct inode *inode, struct file *file)
priv
);
}
agp_remove_controller
(
controller
);
controller
=
NULL
;
}
}
...
...
@@ -698,6 +701,7 @@ static int agp_release(struct inode *inode, struct file *file)
agp_remove_file_private
(
priv
);
kfree
(
priv
);
(
agp_file_private
*
)
file
->
private_data
=
NULL
;
up
(
&
(
agp_fe
.
agp_mutex
));
return
0
;
}
...
...
@@ -860,10 +864,8 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
client_priv
=
agp_find_private
(
reserve
.
pid
);
if
(
client_priv
!=
NULL
)
{
set_bit
(
AGP_FF_IS_CLIENT
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_VALID
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_CLIENT
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_VALID
,
&
client_priv
->
access_flags
);
}
if
(
client
==
NULL
)
{
/* client is already removed */
...
...
@@ -900,15 +902,11 @@ static int agpioc_reserve_wrap(agp_file_private * priv, unsigned long arg)
client_priv
=
agp_find_private
(
reserve
.
pid
);
if
(
client_priv
!=
NULL
)
{
set_bit
(
AGP_FF_IS_CLIENT
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_VALID
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_CLIENT
,
&
client_priv
->
access_flags
);
set_bit
(
AGP_FF_IS_VALID
,
&
client_priv
->
access_flags
);
}
return
agp_create_segment
(
client
,
&
reserve
);
}
else
{
return
agp_create_segment
(
client
,
&
reserve
);
}
return
agp_create_segment
(
client
,
&
reserve
);
}
/* Will never really happen */
return
-
EINVAL
;
...
...
drivers/char/agp/generic.c
View file @
3c5844f3
...
...
@@ -599,7 +599,6 @@ int agp_generic_create_gatt_table(void)
}
EXPORT_SYMBOL
(
agp_generic_create_gatt_table
);
int
agp_generic_suspend
(
void
)
{
return
0
;
...
...
@@ -657,6 +656,12 @@ int agp_generic_free_gatt_table(void)
ClearPageReserved
(
page
);
free_pages
((
unsigned
long
)
agp_bridge
->
gatt_table_real
,
page_order
);
agp_gatt_table
=
NULL
;
agp_bridge
->
gatt_table
=
NULL
;
agp_bridge
->
gatt_table_real
=
NULL
;
agp_bridge
->
gatt_bus_addr
=
NULL
;
return
0
;
}
EXPORT_SYMBOL
(
agp_generic_free_gatt_table
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment