Repository navigation
Commit 91d8866
Drivers: hv: vmbus: Fix memory leak in vmbus_add_channel_kobj
[ Upstream commit 8bc69f8 ]
kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
Fixes: c2e5df6 ("vmbus: add per-channel sysfs info")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Juan Vazquez <juvazq@linux.microsoft.com>
Link: https://lore.kernel.org/r/20220203173008.43480-1-linmq006@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent a176d55 commit 91d8866
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1944 | 1944 | | |
1945 | 1945 | | |
1946 | 1946 | | |
1947 | | - | |
| 1947 | + | |
| 1948 | + | |
1948 | 1949 | | |
| 1950 | + | |
1949 | 1951 | | |
1950 | 1952 | | |
1951 | 1953 | | |
| |||
1954 | 1956 | | |
1955 | 1957 | | |
1956 | 1958 | | |
| 1959 | + | |
1957 | 1960 | | |
1958 | 1961 | | |
1959 | 1962 | | |
| |||
0 commit comments