lkml.org 
[lkml]   [2006]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fix x86 microcode driver handling of multiple matching revisions
On Wed, Apr 26, 2006 at 04:17:56PM +0200, Jan Beulich wrote:
> @@ -197,21 +202,33 @@ static inline void mark_microcode_update
> pr_debug(" Checksum 0x%x\n", cksum);
>
> if (mc_header->rev < uci->rev) {
> - printk(KERN_ERR "microcode: CPU%d not 'upgrading' to earlier revision"
> - " 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
> - goto out;
> + if (uci->err == MC_NOTFOUND) {
> + uci->err = MC_IGNORED;
> + uci->cksum = mc_header->rev;
> + } else if (uci->err == MC_IGNORED && uci->cksum < mc_header->rev)
> + uci->cksum = mc_header->rev;
> } else if (mc_header->rev == uci->rev) {
> - /* notify the caller of success on this cpu */
> - uci->err = MC_SUCCESS;
> - goto out;
> + if (uci->err < MC_MARKED) {
> + /* notify the caller of success on this cpu */
> + uci->err = MC_SUCCESS;
> + }
> + } else if (uci->err != MC_ALLOCATED || mc_header->rev > uci->mc->hdr.rev) {
> + pr_debug("microcode: CPU%d found a matching microcode update with "
> + " revision 0x%x (current=0x%x)\n", cpu_num, mc_header->rev, uci->rev);
> + uci->cksum = cksum;
> + uci->pf = pf; /* keep the original mc pf for cksum calculation */
> + uci->err = MC_MARKED; /* found the match */
> + for_each_online_cpu(cpu_num) {
> + if (ucode_cpu_info[cpu_num].mc == uci->mc) {
> + uci->mc = NULL;
> + break;
> + }

Isn't there a memory leak here? Shouldn't this be
for_each_online_cpu(cpu) {
if (cpu == cpu_num)
continue;
if (ucode_cpu_info[cpu].mc == uci->mc) {
uci->mc = NULL;
break;
}
}
thanks,
suresh

> + }
> + if (uci->mc != NULL) {
> + vfree(uci->mc);
> + uci->mc = NULL;
> + }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-04 19:19    [from the cache]
©2003-2011 Jasper Spaans