Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1728952 > unrolled thread

[PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

Started bySrishti Sharma <srishtishar@gmail.com>
First post2017-09-08 16:10 +0200
Last post2017-09-08 17:00 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON(). Srishti Sharma <srishtishar@gmail.com> - 2017-09-08 16:10 +0200
    Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON()  instead of BUG_ON(). Julia Lawall <julia.lawall@lip6.fr> - 2017-09-08 16:20 +0200
      Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use  WARN_ON() instead of BUG_ON(). Srishti Sharma <srishtishar@gmail.com> - 2017-09-08 16:20 +0200
    Re: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of  BUG_ON(). Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-08 16:40 +0200
      Re: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON(). Srishti Sharma <srishtishar@gmail.com> - 2017-09-08 17:00 +0200

#1728952 — [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

FromSrishti Sharma <srishtishar@gmail.com>
Date2017-09-08 16:10 +0200
Subject[PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().
Message-ID<uns8N-87v-5@gated-at.bofh.it>
Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/media/omap4iss/iss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index c26c99fd..b1036ba 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
 		return;

 	mutex_lock(&iss->iss_mutex);
-	BUG_ON(iss->ref_count == 0);
+	WARN_ON(iss->ref_count == 0);
 	if (--iss->ref_count == 0) {
 		iss_disable_interrupts(iss);
 		/* Reset the ISS if an entity has failed to stop. This is the
--
2.7.4

[toc] | [next] | [standalone]


#1728959 — Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-09-08 16:20 +0200
SubjectRe: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().
Message-ID<unsit-8c2-3@gated-at.bofh.it>
In reply to#1728952

On Fri, 8 Sep 2017, Srishti Sharma wrote:

> Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.
>
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
>  drivers/staging/media/omap4iss/iss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index c26c99fd..b1036ba 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
>  		return;
>
>  	mutex_lock(&iss->iss_mutex);
> -	BUG_ON(iss->ref_count == 0);
> +	WARN_ON(iss->ref_count == 0);
>  	if (--iss->ref_count == 0) {

Won't this then infinite loop?

julia

>  		iss_disable_interrupts(iss);
>  		/* Reset the ISS if an entity has failed to stop. This is the
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1504879698-5855-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

[toc] | [prev] | [next] | [standalone]


#1728960 — Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

FromSrishti Sharma <srishtishar@gmail.com>
Date2017-09-08 16:20 +0200
SubjectRe: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().
Message-ID<unsit-8c2-7@gated-at.bofh.it>
In reply to#1728959
On Fri, Sep 8, 2017 at 7:40 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Fri, 8 Sep 2017, Srishti Sharma wrote:
>
>> Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.
>>
>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> ---
>>  drivers/staging/media/omap4iss/iss.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
>> index c26c99fd..b1036ba 100644
>> --- a/drivers/staging/media/omap4iss/iss.c
>> +++ b/drivers/staging/media/omap4iss/iss.c
>> @@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
>>               return;
>>
>>       mutex_lock(&iss->iss_mutex);
>> -     BUG_ON(iss->ref_count == 0);
>> +     WARN_ON(iss->ref_count == 0);
>>       if (--iss->ref_count == 0) {
>
> Won't this then infinite loop?

 Oh.. yes ! It would, sorry . Please drop this patch .

 Regards,
 Srishti

>
> julia
>
>>               iss_disable_interrupts(iss);
>>               /* Reset the ISS if an entity has failed to stop. This is the
>> --
>> 2.7.4
>>
>> --
>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1504879698-5855-1-git-send-email-srishtishar%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>

[toc] | [prev] | [next] | [standalone]


#1728988 — Re: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-08 16:40 +0200
SubjectRe: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().
Message-ID<unsBQ-8jV-23@gated-at.bofh.it>
In reply to#1728952
On Fri, Sep 08, 2017 at 07:38:18PM +0530, Srishti Sharma wrote:
> Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.
> 
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
>  drivers/staging/media/omap4iss/iss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index c26c99fd..b1036ba 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
>  		return;
> 
>  	mutex_lock(&iss->iss_mutex);
> -	BUG_ON(iss->ref_count == 0);
> +	WARN_ON(iss->ref_count == 0);

ref_counting bugs often have a security aspect.  BUG_ON() is probably
safer here.  Better to crash than to lose all your bitcoin.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1729008

FromSrishti Sharma <srishtishar@gmail.com>
Date2017-09-08 17:00 +0200
Message-ID<unsVc-8sm-13@gated-at.bofh.it>
In reply to#1728988
On Fri, Sep 8, 2017 at 8:08 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Fri, Sep 08, 2017 at 07:38:18PM +0530, Srishti Sharma wrote:
>> Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.
>>
>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> ---
>>  drivers/staging/media/omap4iss/iss.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
>> index c26c99fd..b1036ba 100644
>> --- a/drivers/staging/media/omap4iss/iss.c
>> +++ b/drivers/staging/media/omap4iss/iss.c
>> @@ -893,7 +893,7 @@ void omap4iss_put(struct iss_device *iss)
>>               return;
>>
>>       mutex_lock(&iss->iss_mutex);
>> -     BUG_ON(iss->ref_count == 0);
>> +     WARN_ON(iss->ref_count == 0);
>
> ref_counting bugs often have a security aspect.  BUG_ON() is probably
> safer here.  Better to crash than to lose all your bitcoin.

Okay, Thanks for this.

Regards,
Srishti

>
> regards,
> dan carpenter
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web