Skip to contentSkip to conversation

drivers: mcb: fix memory leak in chameleon_parse_cells() error path

PATCH In review Christoph Jaeger 3 participants 4 messages Apr 4, 2014 – Apr 10, 2014 Men chameleon bus (mcb)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: mcb: fix memory leak in chameleon_parse_cells() error path

chameleon_parse_cells() bails out if chameleon descriptor type is invalid but does not free the storage 'header' points to.

---
 drivers/mcb/mcb-parse.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mcb/mcb-parse.c +1 -0
index d1278b5..0049269 100644
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
 		default:
 			pr_err("Invalid chameleon descriptor type 0x%x\n",
 				dtype);
+			kfree(header);
 			return -EINVAL;
 		}
 		num_cells++;
Signature · 1 line
1.9.0
#1 lore raw
Quoted 21 lines · Christoph Jaeger

chameleon_parse_cells() bails out if chameleon descriptor type is invalid but does not free the storage 'header' points to.

---
 drivers/mcb/mcb-parse.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mcb/mcb-parse.c +1 -1
index d1278b5..0049269 100644
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
 		default:
 			pr_err("Invalid chameleon descriptor type 0x%x\n",
 				dtype);
+			kfree(header);
 			return -EINVAL;
 		}
 		num_cells++;
--
Quoted 2 lines

1.9.0

*Doh*

Thanks for the patch.

@Greg, how should be the process here? Should I collect MCB related patches somewhere and forward them to you, or do you pick them up yourself?

Thanks,
Johannes

#2 lore raw
Quoted 27 lines · Johannes Thumshirn
Quoted 21 lines · Christoph Jaeger

chameleon_parse_cells() bails out if chameleon descriptor type is invalid but does not free the storage 'header' points to.

---
 drivers/mcb/mcb-parse.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mcb/mcb-parse.c +1 -1
index d1278b5..0049269 100644
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
 		default:
 			pr_err("Invalid chameleon descriptor type 0x%x\n",
 				dtype);
+			kfree(header);
 			return -EINVAL;
 		}
 		num_cells++;
--
Quoted 2 lines

1.9.0

*Doh*

Quoted 4 lines

Thanks for the patch.

@Greg, how should be the process here? Should I collect MCB related patches somewhere and forward them to you, or do you pick them up yourself?

Please collect them up and forward them on to me, that's what a maintainer's job is :)

thanks,

greg k-h

#3 lore raw
In reply to Christoph Jaeger
Quoted 21 lines · Christoph Jaeger

chameleon_parse_cells() bails out if chameleon descriptor type is invalid but does not free the storage 'header' points to.

---
 drivers/mcb/mcb-parse.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mcb/mcb-parse.c +1 -1
index d1278b5..0049269 100644
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
 		default:
 			pr_err("Invalid chameleon descriptor type 0x%x\n",
 				dtype);
+			kfree(header);
 			return -EINVAL;
 		}
 		num_cells++;
--
Quoted 2 lines

1.9.0

Hi,

Your patch has been applied to my repo located at:

https://github.com/morbidrsa/linux/tree/mcb

or

git://github.com/morbidrsa/linux.git

Thanks,
Johannes