All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 12:22 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2021-02-01 12:22 UTC (permalink / raw)
  To: Scott Branden
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson, Desmond Yan,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

Unlock before returning on this error path.

Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
index eec90494777d..fc972e43258a 100644
--- a/drivers/misc/bcm-vk/bcm_vk_msg.c
+++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
@@ -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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 12:22 ` Dan Carpenter
  0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2021-02-01 12:22 UTC (permalink / raw)
  To: Scott Branden
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson, Desmond Yan,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

Unlock before returning on this error path.

Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
index eec90494777d..fc972e43258a 100644
--- a/drivers/misc/bcm-vk/bcm_vk_msg.c
+++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
@@ -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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
  2021-02-01 12:22 ` Dan Carpenter
@ 2021-02-01 17:31   ` Scott Branden
  -1 siblings, 0 replies; 10+ messages in thread
From: Scott Branden @ 2021-02-01 17:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson, Desmond Yan,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors



On 2021-02-01 4:22 a.m., Dan Carpenter wrote:
> Unlock before returning on this error path.
>
> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> index eec90494777d..fc972e43258a 100644
> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> @@ -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.
>  			/* flush rd pointer after a message is dequeued */


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 17:31   ` Scott Branden
  0 siblings, 0 replies; 10+ messages in thread
From: Scott Branden @ 2021-02-01 17:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson, Desmond Yan,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors



On 2021-02-01 4:22 a.m., Dan Carpenter wrote:
> Unlock before returning on this error path.
>
> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> index eec90494777d..fc972e43258a 100644
> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> @@ -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.
>  			/* flush rd pointer after a message is dequeued */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
  2021-02-01 17:31   ` Scott Branden
@ 2021-02-01 18:31     ` Desmond Yan
  -1 siblings, 0 replies; 10+ messages in thread
From: Desmond Yan @ 2021-02-01 18:31 UTC (permalink / raw)
  To: Scott Branden
  Cc: Dan Carpenter, Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

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

On Mon, Feb 1, 2021 at 9:31 AM Scott Branden <scott.branden@broadcom.com> wrote:
>
>
>
> On 2021-02-01 4:22 a.m., Dan Carpenter wrote:
> > Unlock before returning on this error path.
> >
> > Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> > index eec90494777d..fc972e43258a 100644
> > --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> > +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> > @@ -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.
> >                       /* flush rd pointer after a message is dequeued */
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4163 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 18:31     ` Desmond Yan
  0 siblings, 0 replies; 10+ messages in thread
From: Desmond Yan @ 2021-02-01 18:31 UTC (permalink / raw)
  To: Scott Branden
  Cc: Dan Carpenter, Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1565 bytes --]

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

On Mon, Feb 1, 2021 at 9:31 AM Scott Branden <scott.branden@broadcom.com> wrote:
>
>
>
> On 2021-02-01 4:22 a.m., Dan Carpenter wrote:
> > Unlock before returning on this error path.
> >
> > Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> > index eec90494777d..fc972e43258a 100644
> > --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> > +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> > @@ -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.
> >                       /* flush rd pointer after a message is dequeued */
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4163 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
  2021-02-01 12:22 ` Dan Carpenter
@ 2021-02-01 18:32   ` Desmond Yan
  -1 siblings, 0 replies; 10+ messages in thread
From: Desmond Yan @ 2021-02-01 18:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Scott Branden, Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

Acked-by: Desmond Yan <desmond.yan@broadcom.com>

On Mon, Feb 1, 2021 at 4:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Unlock before returning on this error path.
>
> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> index eec90494777d..fc972e43258a 100644
> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> @@ -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
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4163 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 18:32   ` Desmond Yan
  0 siblings, 0 replies; 10+ messages in thread
From: Desmond Yan @ 2021-02-01 18:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Scott Branden, Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

Acked-by: Desmond Yan <desmond.yan@broadcom.com>

On Mon, Feb 1, 2021 at 4:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Unlock before returning on this error path.
>
> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
> index eec90494777d..fc972e43258a 100644
> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
> @@ -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
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4163 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
  2021-02-01 18:32   ` Desmond Yan
@ 2021-02-01 22:49     ` Scott Branden
  -1 siblings, 0 replies; 10+ messages in thread
From: Scott Branden @ 2021-02-01 22:49 UTC (permalink / raw)
  To: Desmond Yan, Dan Carpenter
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

Great, looks good then.

On 2021-02-01 10:32 a.m., Desmond Yan wrote:
> Acked-by: Desmond Yan <desmond.yan@broadcom.com>
Acked-by: Scott Branden <scott.branden@broadcom.com>
>
> On Mon, Feb 1, 2021 at 4:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>> Unlock before returning on this error path.
>>
>> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
>> index eec90494777d..fc972e43258a 100644
>> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
>> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
>> @@ -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
>>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue()
@ 2021-02-01 22:49     ` Scott Branden
  0 siblings, 0 replies; 10+ messages in thread
From: Scott Branden @ 2021-02-01 22:49 UTC (permalink / raw)
  To: Desmond Yan, Dan Carpenter
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Olof Johansson,
	bcm-kernel-feedback-list, linux-kernel, kernel-janitors

Great, looks good then.

On 2021-02-01 10:32 a.m., Desmond Yan wrote:
> Acked-by: Desmond Yan <desmond.yan@broadcom.com>
Acked-by: Scott Branden <scott.branden@broadcom.com>
>
> On Mon, Feb 1, 2021 at 4:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>> Unlock before returning on this error path.
>>
>> Fixes: 111d746bb476 ("misc: bcm-vk: add VK messaging support")
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>>  drivers/misc/bcm-vk/bcm_vk_msg.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/bcm-vk/bcm_vk_msg.c b/drivers/misc/bcm-vk/bcm_vk_msg.c
>> index eec90494777d..fc972e43258a 100644
>> --- a/drivers/misc/bcm-vk/bcm_vk_msg.c
>> +++ b/drivers/misc/bcm-vk/bcm_vk_msg.c
>> @@ -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
>>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-01 22:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 12:22 [PATCH] misc: bcm-vk: unlock on error in bcm_to_h_msg_dequeue() Dan Carpenter
2021-02-01 12:22 ` Dan Carpenter
2021-02-01 17:31 ` Scott Branden
2021-02-01 17:31   ` Scott Branden
2021-02-01 18:31   ` Desmond Yan
2021-02-01 18:31     ` Desmond Yan
2021-02-01 18:32 ` Desmond Yan
2021-02-01 18:32   ` Desmond Yan
2021-02-01 22:49   ` Scott Branden
2021-02-01 22:49     ` Scott Branden

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.