Skip to content

Commit 8910b49

Browse files
Micah GruberJeff Garzik
authored andcommitted
Fix a potential NULL pointer dereference in free_shared_mem() in drivers/net/s2io.c
This patch fixes a potential null dereference bug where we dereference nic before a null check. This patch simply moves the dereferencing after the null check. Signed-off-by: Micah Gruber < [email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent 4c75f74 commit 8910b49

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/s2io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,12 +796,14 @@ static void free_shared_mem(struct s2io_nic *nic)
796796
struct mac_info *mac_control;
797797
struct config_param *config;
798798
int lst_size, lst_per_page;
799-
struct net_device *dev = nic->dev;
799+
struct net_device *dev;
800800
int page_num = 0;
801801

802802
if (!nic)
803803
return;
804804

805+
dev = nic->dev;
806+
805807
mac_control = &nic->mac_control;
806808
config = &nic->config;
807809

0 commit comments

Comments
 (0)