netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB
@ 2017-04-10 22:39 Myungho Jung
  0 siblings, 0 replies; 5+ messages in thread
From: Myungho Jung @ 2017-04-10 22:39 UTC (permalink / raw)
  To: davem; +Cc: netdev, chunkeey, Myungho Jung

Added NULL check to make __dev_kfree_skb_irq consistent with kfree
family of functions.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289

Signed-off-by: Myungho Jung <mhjungk@gmail.com>
---
 net/core/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 7869ae3..22be2a6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
 {
 	unsigned long flags;
 
+	if (unlikely(!skb))
+		return;
+
 	if (likely(atomic_read(&skb->users) == 1)) {
 		smp_rmb();
 		atomic_set(&skb->users, 0);
-- 
2.7.4

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

* [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB
@ 2017-04-20 18:25 Myungho Jung
  2017-04-20 23:03 ` Greg Rose
  0 siblings, 1 reply; 5+ messages in thread
From: Myungho Jung @ 2017-04-20 18:25 UTC (permalink / raw)
  To: edumazet; +Cc: netdev

Added NULL check to make __dev_kfree_skb_irq consistent with kfree
family of functions.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289

Signed-off-by: Myungho Jung <mhjungk@gmail.com>
---
 net/core/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 7869ae3..22be2a6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
 {
 	unsigned long flags;
 
+	if (unlikely(!skb))
+		return;
+
 	if (likely(atomic_read(&skb->users) == 1)) {
 		smp_rmb();
 		atomic_set(&skb->users, 0);
-- 
2.7.4

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

* Re: [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB
  2017-04-20 18:25 [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB Myungho Jung
@ 2017-04-20 23:03 ` Greg Rose
  2017-04-20 23:23   ` Myungho Jung
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Rose @ 2017-04-20 23:03 UTC (permalink / raw)
  To: Myungho Jung; +Cc: edumazet, netdev

On Thu, 2017-04-20 at 11:25 -0700, Myungho Jung wrote:
> Added NULL check to make __dev_kfree_skb_irq consistent with kfree
> family of functions.
> 
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289
> 
> Signed-off-by: Myungho Jung <mhjungk@gmail.com>

Hi,

I think the patch is fine but I'm confused by the subject.  You mention
p54 driver but the change is in dev.c.  I know the bugzilla references
the p54 but that's not where the change is.

Seems odd to me.

- Greg

> ---
>  net/core/dev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 7869ae3..22be2a6 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
>  {
>  	unsigned long flags;
>  
> +	if (unlikely(!skb))
> +		return;
> +
>  	if (likely(atomic_read(&skb->users) == 1)) {
>  		smp_rmb();
>  		atomic_set(&skb->users, 0);

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

* Re: [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB
  2017-04-20 23:03 ` Greg Rose
@ 2017-04-20 23:23   ` Myungho Jung
  2017-04-20 23:25     ` Greg Rose
  0 siblings, 1 reply; 5+ messages in thread
From: Myungho Jung @ 2017-04-20 23:23 UTC (permalink / raw)
  To: Greg Rose; +Cc: edumazet, netdev

On Thu, Apr 20, 2017 at 04:03:43PM -0700, Greg Rose wrote:
> On Thu, 2017-04-20 at 11:25 -0700, Myungho Jung wrote:
> > Added NULL check to make __dev_kfree_skb_irq consistent with kfree
> > family of functions.
> > 
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289
> > 
> > Signed-off-by: Myungho Jung <mhjungk@gmail.com>
> 
> Hi,
> 
> I think the patch is fine but I'm confused by the subject.  You mention
> p54 driver but the change is in dev.c.  I know the bugzilla references
> the p54 but that's not where the change is.
> 
> Seems odd to me.
> 
> - Greg
> 
> > ---
> >  net/core/dev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 7869ae3..22be2a6 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
> >  {
> >  	unsigned long flags;
> >  
> > +	if (unlikely(!skb))
> > +		return;
> > +
> >  	if (likely(atomic_read(&skb->users) == 1)) {
> >  		smp_rmb();
> >  		atomic_set(&skb->users, 0);
> 
> 
> 

Hi Greg,

Thank you for checking my patch. I missed that I moved change from p54
to net/dev. Do I need to resubmit patch v2 to modify subject?

Thanks,
Myungho

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

* Re: [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB
  2017-04-20 23:23   ` Myungho Jung
@ 2017-04-20 23:25     ` Greg Rose
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Rose @ 2017-04-20 23:25 UTC (permalink / raw)
  To: Myungho Jung; +Cc: edumazet, netdev

On Thu, 2017-04-20 at 16:23 -0700, Myungho Jung wrote:
> On Thu, Apr 20, 2017 at 04:03:43PM -0700, Greg Rose wrote:
> > On Thu, 2017-04-20 at 11:25 -0700, Myungho Jung wrote:
> > > Added NULL check to make __dev_kfree_skb_irq consistent with kfree
> > > family of functions.
> > > 
> > > Link: https://bugzilla.kernel.org/show_bug.cgi?id=195289
> > > 
> > > Signed-off-by: Myungho Jung <mhjungk@gmail.com>
> > 
> > Hi,
> > 
> > I think the patch is fine but I'm confused by the subject.  You mention
> > p54 driver but the change is in dev.c.  I know the bugzilla references
> > the p54 but that's not where the change is.
> > 
> > Seems odd to me.
> > 
> > - Greg
> > 
> > > ---
> > >  net/core/dev.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/net/core/dev.c b/net/core/dev.c
> > > index 7869ae3..22be2a6 100644
> > > --- a/net/core/dev.c
> > > +++ b/net/core/dev.c
> > > @@ -2450,6 +2450,9 @@ void __dev_kfree_skb_irq(struct sk_buff *skb, enum skb_free_reason reason)
> > >  {
> > >  	unsigned long flags;
> > >  
> > > +	if (unlikely(!skb))
> > > +		return;
> > > +
> > >  	if (likely(atomic_read(&skb->users) == 1)) {
> > >  		smp_rmb();
> > >  		atomic_set(&skb->users, 0);
> > 
> > 
> > 
> 
> Hi Greg,
> 
> Thank you for checking my patch. I missed that I moved change from p54
> to net/dev. Do I need to resubmit patch v2 to modify subject?
> 
> Thanks,
> Myungho

Yes, I think that's the best idea.

Thanks,

- Greg

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

end of thread, other threads:[~2017-04-20 23:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 18:25 [PATCH] p54: Prevent from dereferencing null pointer when releasing SKB Myungho Jung
2017-04-20 23:03 ` Greg Rose
2017-04-20 23:23   ` Myungho Jung
2017-04-20 23:25     ` Greg Rose
  -- strict thread matches above, loose matches on Subject: below --
2017-04-10 22:39 Myungho Jung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).