2017-09-08 14:09:28

by Srishti Sharma

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

Use WARN_ON() instead of BUG_ON() to avoid crashing the kernel.

Signed-off-by: Srishti Sharma <[email protected]>
---
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


2017-09-08 14:10:41

by Julia Lawall

[permalink] [raw]
Subject: Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().



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 <[email protected]>
> ---
> 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 [email protected].
> To post to this group, send email to [email protected].
> 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.
>

2017-09-08 14:17:05

by Srishti Sharma

[permalink] [raw]
Subject: Re: [Outreachy kernel] [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

On Fri, Sep 8, 2017 at 7:40 PM, Julia Lawall <[email protected]> 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 <[email protected]>
>> ---
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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.
>>

2017-09-08 14:39:06

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

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 <[email protected]>
> ---
> 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

2017-09-08 14:59:36

by Srishti Sharma

[permalink] [raw]
Subject: Re: [PATCH] Staging: media: omap4iss: Use WARN_ON() instead of BUG_ON().

On Fri, Sep 8, 2017 at 8:08 PM, Dan Carpenter <[email protected]> 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 <[email protected]>
>> ---
>> 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
>