aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-07-22 04:02:01 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-24 18:44:51 -0400
commit64d2c22a4cdd3ce752ca700964a6120049d78aed (patch)
tree410759eb9531acd078d11ae2b8c554eb3f617873 /drivers/net/ethernet
parent4ea72445bddd2ca09fc719065fc3c5a8bfc8ca10 (diff)
mlx5: use after free in mlx5_cmd_comp_handler()
We can't dereference "ent" after passing it to free_cmd(). Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/cmd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 205753a04cfc..40374063c01e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -1113,7 +1113,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
1113 1113
1114 for (i = 0; i < (1 << cmd->log_sz); i++) { 1114 for (i = 0; i < (1 << cmd->log_sz); i++) {
1115 if (test_bit(i, &vector)) { 1115 if (test_bit(i, &vector)) {
1116 struct semaphore *sem;
1117
1116 ent = cmd->ent_arr[i]; 1118 ent = cmd->ent_arr[i];
1119 if (ent->page_queue)
1120 sem = &cmd->pages_sem;
1121 else
1122 sem = &cmd->sem;
1117 ktime_get_ts(&ent->ts2); 1123 ktime_get_ts(&ent->ts2);
1118 memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); 1124 memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out));
1119 dump_command(dev, ent, 0); 1125 dump_command(dev, ent, 0);
@@ -1136,10 +1142,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector)
1136 } else { 1142 } else {
1137 complete(&ent->done); 1143 complete(&ent->done);
1138 } 1144 }
1139 if (ent->page_queue) 1145 up(sem);
1140 up(&cmd->pages_sem);
1141 else
1142 up(&cmd->sem);
1143 } 1146 }
1144 } 1147 }
1145} 1148}