All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2012-08-09 13:54 Fengguang Wu
  2012-08-09 17:29 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 14+ messages in thread
From: Fengguang Wu @ 2012-08-09 13:54 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Dave Peterson, kernel-janitors, Doug Thompson, linux-edac, linux-kernel

Subject: possible double free in edac_mc_alloc()
Reply-To: 
User-Agent: Heirloom mailx 12.5 6/20/10

Hi,

coccinelle warns about:

+ drivers/edac/edac_mc.c:429:9-23: ERROR: reference preceded by free on line 429

and that line does look strange: the 'i' seems like a temporary value
used in previous loops, and it won't change at all in the current
loop. Which means the same mci->csrows[i] get freed once and again.
It might also do double free for the previous kfree(csr) line.

vim +429 drivers/edac/edac_mc.c

   416         if (mci->dimms) {
   417                 for (i = 0; i < tot_dimms; i++)
   418                         kfree(mci->dimms[i]);
   419                 kfree(mci->dimms);
   420         }
   421         if (mci->csrows) {
   422                 for (chn = 0; chn < tot_channels; chn++) {
   423                         csr = mci->csrows[chn];
   424                         if (csr) {
   425                                 for (chn = 0; chn < tot_channels; chn++)
   426						kfree(csr->channels[chn]);
   427					kfree(csr);
   428				}
 > 429				kfree(mci->csrows[i]);
   430			}
   431			kfree(mci->csrows);
   432		}

---
0-DAY kernel build testing backend         Open Source Technology Centre
Fengguang Wu <wfg@linux.intel.com>                     Intel Corporation

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-09-14 18:08 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09 13:54 Fengguang Wu
2012-08-09 17:29 ` Mauro Carvalho Chehab
2012-08-10  9:22   ` [PATCH] edac_mc: fix kfree calls in the error path Fengguang Wu
2012-08-10  9:22     ` Fengguang Wu
2012-08-19  4:11     ` [PATCH 0/3] Fix edac_mc crash in e7xxx_edac " Shaun Ruffell
2012-08-19  4:11       ` [PATCH 1/3] edac_mc: fix kfree calls in the " Shaun Ruffell
2012-08-19  4:11       ` [PATCH 2/3] edac: edac_mc_free() cannot assume mem_ctl_info is registered in sysfs Shaun Ruffell
2012-08-19  4:11       ` [PATCH 3/3] edac: edac_mc no longer deals with kobjects directly Shaun Ruffell
2012-09-08 18:49       ` [PATCH 0/3] Fix edac_mc crash in e7xxx_edac error path Shaun Ruffell
2012-09-14 17:58       ` [PATCH v2 " Shaun Ruffell
2012-09-14 17:58         ` [PATCH v2 1/3] edac_mc: fix kfree calls in the " Shaun Ruffell
2012-09-14 18:01           ` Shaun Ruffell
2012-09-14 17:58         ` [PATCH v2 2/3] edac: edac_mc_free() cannot assume mem_ctl_info is registered in sysfs Shaun Ruffell
2012-09-14 17:58         ` [PATCH v2 3/3] edac: edac_mc no longer deals with kobjects directly Shaun Ruffell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.