Skip to contentSkip to conversation

iwmc3200wifi: using freed memory in iwm_hal_send_target_cmd()

DISCUSSION Dan Carpenter 2 participants 2 messages Jul 19, 2009 – Jul 20, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I found this with a source code checker (http://repo.or.cz/w/smatch.git).

We free "cmd" on line 390 and then dereference it on line 396. I don't know what we should return in that case or I would have sent a patch. Sorry.

drivers/net/wireless/iwmc3200wifi/hal.c
390 if (!udma_cmd->resp)
391 kfree(cmd);
392
393 if (ret < 0)
394 return ret;
395
396 return cmd->seq_num;

regards,
dan carpenter

#1 lore raw
Quoted 8 lines · Dan Carpenter

Hello,

I found this with a source code checker (http://repo.or.cz/w/smatch.git).

We free "cmd" on line 390 and then dereference it on line 396. I don't know what we should return in that case or I would have sent a patch. Sorry.

Quoted 8 lines

drivers/net/wireless/iwmc3200wifi/hal.c
390 if (!udma_cmd->resp)

   391                  kfree(cmd);
   392  
   393          if (ret < 0)
   394                  return ret;
   395  
   396          return cmd->seq_num;

Good catch! I'll send out a patch later.

Thanks,
-yi