misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
Subsystems (3)
PATCH 1/1 misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
Unlock before returning on this error path.
--- drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/misc/bcm-vk/bcm_vk_msg.c +2 -1
@@ -849,7 +849,8 @@ s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)* that is fatal. */ dev_crit (dev,"Kernel mem allocation failure.\n" ); -return -ENOMEM ; + total = -ENOMEM ; + goto idx_err; }/* flush rd pointer after a message is dequeued */
Signature · 1 line
2.29.2
Scott Branden
maintainerQuoted 13 lines · Dan Carpenter
Unlock before returning on this error path.
Fixes 111d746bb476 ("misc: bcm-vk: add VK messaging support")Signed-off-by Dan Carpenter <[email protected]>--- drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/misc/bcm-vk/bcm_vk_msg.c +0
-0
drivers/misc/bcm-vk/bcm_vk_msg.c s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk) · line 855
Quoted 8 lines
drivers/misc/bcm-vk/bcm_vk_msg.c +2
-1@@ -849,7 +849,8 @@ s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)* that is fatal. */ dev_crit (dev,"Kernel mem allocation failure.\n" ); -return -ENOMEM ; + total = -ENOMEM ; + goto idx_err; }
This is a pretty fatal case if we fail to allocate memory here.
Will let Desmond respond if we wanted to keep the mutex locked forever in this case or if we do want to return and keep mutex locked if it is fatal and there is no real recovery path.
Quoted 1 line
drivers/misc/bcm-vk/bcm_vk_msg.c +0
-0/* flush rd pointer after a message is dequeued */
Yes, in this situation, it is fatal and we would turn off processing anyway. But, Dan's change seems more appropriate and proper practice (thxs for the patch).
Des
Quoted 31 lines · Scott Branden
Quoted 13 lines · Dan Carpenter
Unlock before returning on this error path.
Fixes 111d746bb476 ("misc: bcm-vk: add VK messaging support")Signed-off-by Dan Carpenter <[email protected]>--- drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/misc/bcm-vk/bcm_vk_msg.c +0
-0drivers/misc/bcm-vk/bcm_vk_msg.c s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk) · line 855
Quoted 8 lines
drivers/misc/bcm-vk/bcm_vk_msg.c +2
-1@@ -849,7 +849,8 @@ s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)* that is fatal. */ dev_crit (dev,"Kernel mem allocation failure.\n" ); -return -ENOMEM ; + total = -ENOMEM ; + goto idx_err; }This is a pretty fatal case if we fail to allocate memory here.
Will let Desmond respond if we wanted to keep the mutex locked forever in this case or if we do want to return and keep mutex locked if it is fatal and there is no real recovery path.Quoted 1 line
drivers/misc/bcm-vk/bcm_vk_msg.c +0
-0/* flush rd pointer after a message is dequeued */
Quoted 26 lines · Dan Carpenter
Unlock before returning on this error path.
Fixes 111d746bb476 ("misc: bcm-vk: add VK messaging support")Signed-off-by Dan Carpenter <[email protected]>--- drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/misc/bcm-vk/bcm_vk_msg.c +2
-2@@ -849,7 +849,8 @@ s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)* that is fatal. */ dev_crit (dev,"Kernel mem allocation failure.\n" ); -return -ENOMEM ; + total = -ENOMEM ; + goto idx_err; }/* flush rd pointer after a message is dequeued */ --2.29.2
Great, looks good then.
Quoted 1 line · Desmond Yan
Acked-by Desmond Yan <[email protected]>
Quoted 27 lines · Dan Carpenter
Quoted 25 lines
Unlock before returning on this error path.
Fixes 111d746bb476 ("misc: bcm-vk: add VK messaging support")Signed-off-by Dan Carpenter <[email protected]>--- drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/misc/bcm-vk/bcm_vk_msg.c +2
-2@@ -849,7 +849,8 @@ s32 bcm_to_h_msg_dequeue(struct bcm_vk *vk)* that is fatal. */ dev_crit (dev,"Kernel mem allocation failure.\n" ); -return -ENOMEM ; + total = -ENOMEM ; + goto idx_err; }/* flush rd pointer after a message is dequeued */ --2.29.2