clk: core: Potentially free connection id
PATCH 1/1 clk: core: Potentially free connection id
Patch "clk: core: Copy connection id" made it so that the connector id (con_id) is kstrdup_const'ed to cater to drivers that pass non- constant connection ids. The patch added the corresponding kfree_const to __clk_free_clk, but struct clk's can be freed also via __clk_put. Add the kfree_const call to __clk_put and add comments to both functions to remind that the logic in them should be kept in sync.
--- drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clk/clk.c +3 -0
@@ -3132,6 +3132,7 @@ struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id,return clk; } +/* keep in sync with __clk_put */ void __clk_free_clk (struct clk *clk) {clk_prepare_lock ();
@@ -3511,6 +3512,7 @@ int __clk_get(struct clk *clk)return 1 ; } +/* keep in sync with __clk_free_clk */ void __clk_put (struct clk *clk) {struct module *owner;
@@ -3544,6 +3546,7 @@ void __clk_put(struct clk *clk)module_put (owner); +kfree_const (clk->con_id);kfree (clk); }
Signature · 1 line
2.16.1
T24gV2VkLCAyMDE4LTA3LTExIGF0IDExOjIxICswMzAwLCBNaWtrbyBQZXJ0dHVuZW4gd3JvdGU6 DQo+IFBhdGNoICJjbGs6IGNvcmU6IENvcHkgY29ubmVjdGlvbiBpZCIgbWFkZSBpdCBzbyB0aGF0 IHRoZSBjb25uZWN0b3INCj4gaWQgKGNvbl9pZCkgaXMga3N0cmR1cF9jb25zdCdlZCB0byBjYXRl ciB0byBkcml2ZXJzIHRoYXQgcGFzcyBub24tDQo+IGNvbnN0YW50IGNvbm5lY3Rpb24gaWRzLiBU aGUgcGF0Y2ggYWRkZWQgdGhlIGNvcnJlc3BvbmRpbmcNCj4ga2ZyZWVfY29uc3QNCj4gdG8gX19j bGtfZnJlZV9jbGssIGJ1dCBzdHJ1Y3QgY2xrJ3MgY2FuIGJlIGZyZWVkIGFsc28gdmlhIF9fY2xr X3B1dC4NCj4gQWRkIHRoZSBrZnJlZV9jb25zdCBjYWxsIHRvIF9fY2xrX3B1dCBhbmQgYWRkIGNv bW1lbnRzIHRvIGJvdGgNCj4gZnVuY3Rpb25zIHRvIHJlbWluZCB0aGF0IHRoZSBsb2dpYyBpbiB0 aGVtIHNob3VsZCBiZSBrZXB0IGluIHN5bmMuDQo+IA0KPiBGaXhlczogMjUzMTYwYThhZDA2ICgi Y2xrOiBjb3JlOiBDb3B5IGNvbm5lY3Rpb24gaWQiKQ0KPiBTaWduZWQtb2ZmLWJ5OiBNaWtrbyBQ ZXJ0dHVuZW4gPG1wZXJ0dHVuZW5AbnZpZGlhLmNvbT4NCg0KWWVzLCBzb3JyeSBJIG1pc3NlZCB0 aGlzLg0KDQpSZXZpZXdlZC1ieTogTGVvbmFyZCBDcmVzdGV6IDxsZW9uYXJkLmNyZXN0ZXpAbnhw LmNvbT4NCg0KTWF5YmUgYSBzdGF0aWMgX19jbGtfZnJlZV9tZW0gZnVuY3Rpb24gY291bGQgYmUg Y3JlYXRlZCBpbnN0ZWFkIG9mDQpjb21tZW50cyBhc2tpbmcgdG8ga2VlcCB0aGluZ3MgaW4gc3lu Yz8gQnV0IHRoZXJlIGFyZSBvbmx5IDIgbGluZXMgc28NCml0J3MgZmluZS4=
Quoting Mikko Perttunen (2018-07-11 01:21:04)
Quoted 11 lines
Patch "clk: core: Copy connection id" made it so that the connector id (
con_id) is kstrdup_const'ed to cater to drivers that pass non- constant connection ids. The patch added the correspondingkfree_constto__clk_free_clk, but struct clk's can be freed also via__clk_put. Add thekfree_constcall to__clk_putand add comments to both functions to remind that the logic in them should be kept in sync. =Fixes 253160a8ad06 ("clk: core: Copy connection id")Signed-off-by Mikko Perttunen <[email protected]>---
Applied to clk-next