liveupdate: luo_session: Fix a couple Smatch issues
cover liveupdate: luo_session: Fix a couple Smatch issues
Smatch detected these two bugs.
Dan Carpenter (2):
liveupdate: luo_session: Fix uninitialized variable in
luo_session_setup_outgoing()
liveupdate: luo_session: Fix use after free in
luo_session_deserialize()
kernel/liveupdate/luo_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.0
PATCH 1/2 liveupdate: luo_session: Fix uninitialized variable in luo_session_setup_outgoing()
The "header_ser" variable is uninitialized. The "outgoing_buffer" variable was intended here, so use that instead.
--- kernel/liveupdate/luo_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/liveupdate/luo_session.c +1 -1
@@ -447,7 +447,7 @@ int __init luo_session_setup_outgoing(void *fdt_out) outgoing_buffer =kho_alloc_preserve (LUO_SESSION_PGCNT <<PAGE_SHIFT );if (IS_ERR (outgoing_buffer)) -return PTR_ERR (header_ser); +return PTR_ERR (outgoing_buffer); header_ser = outgoing_buffer; header_ser_pa =virt_to_phys (header_ser);
Signature · 1 line
2.51.0
PATCH 2/2 liveupdate: luo_session: Fix use after free in luo_session_deserialize()
In reply to Dan CarpenterThe debug output frees "session" but it was freed on the previous line. Move the free after the printk().
--- kernel/liveupdate/luo_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/liveupdate/luo_session.c +1 -1
@@ -553,9 +553,9 @@ int luo_session_deserialize(void) err =luo_session_insert (sh, session);if (err) { -luo_session_free (session);pr_warn ("Failed to insert session [%s] %pe\n" , session->name,ERR_PTR (err)); +luo_session_free (session);return err; }
Signature · 1 line
2.51.0
Pasha Tatashin
maintainerRe: [PATCH 1/2] liveupdate: luo_session: Fix uninitialized variable in luo_session_setup_outgoing()
In reply to Dan CarpenterQuoted 15 lines · Dan Carpenter
The "
header_ser" variable is uninitialized. The "outgoing_buffer" variable was intended here, so use that instead.Fixes 7eeeec7e1690 ("liveupdate: luo_session: add sessions support")Signed-off-by Dan Carpenter <[email protected]>--- kernel/liveupdate/luo_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/liveupdate/luo_session.c +0
-0
kernel/liveupdate/luo_session.c int __init luo_session_setup_outgoing(void *fdt_out) · line 452
Quoted 7 lines
kernel/liveupdate/luo_session.c +1
-1@@ -447,7 +447,7 @@ int __init luo_session_setup_outgoing(void *fdt_out) outgoing_buffer =kho_alloc_preserve (LUO_SESSION_PGCNT <<PAGE_SHIFT );if (IS_ERR (outgoing_buffer)) -return PTR_ERR (header_ser); +return PTR_ERR (outgoing_buffer); header_ser = outgoing_buffer; header_ser_pa =virt_to_phys (header_ser);
This is already fixed in LUOv8.
Thank you,
Pasha
Quoted 4 lines
kernel/liveupdate/luo_session.c +0
-1--2.51.0
Pasha Tatashin
maintainerRe: [PATCH 2/2] liveupdate: luo_session: Fix use after free in luo_session_deserialize()
In reply to Dan CarpenterQuoted 15 lines · Dan Carpenter
The debug output frees "session" but it was freed on the previous line. Move the free after the
printk().Fixes 7eeeec7e1690 ("liveupdate: luo_session: add sessions support")Signed-off-by Dan Carpenter <[email protected]>--- kernel/liveupdate/luo_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/liveupdate/luo_session.c +0
-0
kernel/liveupdate/luo_session.c int luo_session_deserialize(void) · line 560
Quoted 9 lines
kernel/liveupdate/luo_session.c +1
-1@@ -553,9 +553,9 @@ int luo_session_deserialize(void) err =luo_session_insert (sh, session);if (err) { -luo_session_free (session);pr_warn ("Failed to insert session [%s] %pe\n" , session->name,ERR_PTR (err)); +luo_session_free (session);return err; }
Andrew, could you please add this fix-up to "liveupdate: luo_session:
add sessions support"
Thank you,
Pasha
Quoted 4 lines
kernel/liveupdate/luo_session.c +0
-1--2.51.0
Pasha Tatashin
maintainerQuoted 2 lines · Dan Carpenter
Smatch detected these two bugs.
That's awesome, thank you for testing.
Pasha
Quoted 13 lines
Dan Carpenter (2):
liveupdate:luo_session: Fix uninitialized variable in
luo_session_setup_outgoing()
liveupdate:luo_session: Fix use after free in
luo_session_deserialize()kernel/liveupdate/luo_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)--
2.51.0
Mike Rapoport
maintainer(added Dan Carpenter)
Quoted 14 lines · Dan Carpenter
Smatch detected these two bugs.
Dan Carpenter (2):
liveupdate:luo_session: Fix uninitialized variable in
luo_session_setup_outgoing()
liveupdate:luo_session: Fix use after free in
luo_session_deserialize()kernel/liveupdate/luo_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
2.51.0
Signature · 2 lines
Sincerely yours, Mike.
Mike Rapoport
maintainerWrong thread, sorry for the noise
Quoted 21 lines · Mike Rapoport
(added Dan Carpenter)
Quoted 14 lines · Dan Carpenter
Smatch detected these two bugs.
Dan Carpenter (2):
liveupdate:luo_session: Fix uninitialized variable in
luo_session_setup_outgoing()
liveupdate:luo_session: Fix use after free in
luo_session_deserialize()kernel/liveupdate/luo_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
2.51.0Signature · 2 lines
Sincerely yours, Mike.
Signature · 2 lines
Sincerely yours, Mike.