linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net: sctp: possible dereference after freeing
@ 2013-10-19 11:38 Geyslan Gregório Bem
  2013-10-19 11:49 ` Geyslan Gregório Bem
  0 siblings, 1 reply; 3+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-19 11:38 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: Neil Horman, David S. Miller, linux-sctp, netdev, LKML

Hi maintainers,

I would like to know if these are catches:

/net/sctp/endpointola.c (281)
static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
{
    struct sock *sk;
...
    kfree(ep);
    SCTP_DBG_OBJCNT_DEC(ep);
}

The 'ep' object counter is being decremented?! Is the kfree to be there indeed?
Let me know what was intended here.

Same here:
/net/sctp/endpointola.c (165)
static void sctp_transport_destroy_rcu(struct rcu_head *head)
{
    struct sctp_transport *transport;
...
    kfree(transport);
    SCTP_DBG_OBJCNT_DEC(transport);
}

Regards,

Geyslan Gregório Bem
hackingbits.com

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

* Re: net: sctp: possible dereference after freeing
  2013-10-19 11:38 net: sctp: possible dereference after freeing Geyslan Gregório Bem
@ 2013-10-19 11:49 ` Geyslan Gregório Bem
  2013-10-19 17:36   ` Vlad Yasevich
  0 siblings, 1 reply; 3+ messages in thread
From: Geyslan Gregório Bem @ 2013-10-19 11:49 UTC (permalink / raw)
  To: Vlad Yasevich; +Cc: Neil Horman, David S. Miller, linux-sctp, netdev, LKML

2013/10/19 Geyslan Gregório Bem <geyslan@gmail.com>:
> Hi maintainers,
>
> I would like to know if these are catches:
>
> /net/sctp/endpointola.c (281)
> static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
> {
>     struct sock *sk;
> ...
>     kfree(ep);
>     SCTP_DBG_OBJCNT_DEC(ep);
> }
>
> The 'ep' object counter is being decremented?! Is the kfree to be there indeed?
> Let me know what was intended here.
>
> Same here:
> /net/sctp/endpointola.c (165)
> static void sctp_transport_destroy_rcu(struct rcu_head *head)
> {
>     struct sctp_transport *transport;
> ...
>     kfree(transport);
>     SCTP_DBG_OBJCNT_DEC(transport);
> }
>
> Regards,
>
> Geyslan Gregório Bem
> hackingbits.com

Oops. I got it. ;)

extern atomic_t sctp_dbg_objcnt_ep;
http://lxr.free-electrons.com/source/include/net/sctp/sctp.h#L269
extern atomic_t sctp_dbg_objcnt_transport;
http://lxr.free-electrons.com/source/arch/x86/include/asm/atomic.h#L105

Cheers.

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

* Re: net: sctp: possible dereference after freeing
  2013-10-19 11:49 ` Geyslan Gregório Bem
@ 2013-10-19 17:36   ` Vlad Yasevich
  0 siblings, 0 replies; 3+ messages in thread
From: Vlad Yasevich @ 2013-10-19 17:36 UTC (permalink / raw)
  To: Geyslan Gregório Bem
  Cc: Neil Horman, David S. Miller, linux-sctp, netdev, LKML



On Oct 19, 2013, at 7:49 AM, Geyslan Gregório Bem <geyslan@gmail.com> wrote:

> 2013/10/19 Geyslan Gregório Bem <geyslan@gmail.com>:
>> Hi maintainers,
>> 
>> I would like to know if these are catches:
>> 
>> /net/sctp/endpointola.c (281)
>> static void sctp_endpoint_destroy(struct sctp_endpoint *ep)
>> {
>>    struct sock *sk;
>> ...
>>    kfree(ep);
>>    SCTP_DBG_OBJCNT_DEC(ep);
>> }
>> 
>> The 'ep' object counter is being decremented?! Is the kfree to be there indeed?
>> Let me know what was intended here.
>> 
>> Same here:
>> /net/sctp/endpointola.c (165)
>> static void sctp_transport_destroy_rcu(struct rcu_head *head)
>> {
>>    struct sctp_transport *transport;
>> ...
>>    kfree(transport);
>>    SCTP_DBG_OBJCNT_DEC(transport);
>> }
>> 
>> Regards,
>> 
>> Geyslan Gregório Bem
>> hackingbits.com
> 
> Oops. I got it. ;)
> 
> extern atomic_t sctp_dbg_objcnt_ep;
> http://lxr.free-electrons.com/source/include/net/sctp/sctp.h#L269
> extern atomic_t sctp_dbg_objcnt_transport;
> http://lxr.free-electrons.com/source/arch/x86/include/asm/atomic.h#L105
> 
> Cheers.

There is no reference here since the macro turns variable name to string using ## name.
So the order doesn't matter really.

-vlad 

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

end of thread, other threads:[~2013-10-19 17:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-19 11:38 net: sctp: possible dereference after freeing Geyslan Gregório Bem
2013-10-19 11:49 ` Geyslan Gregório Bem
2013-10-19 17:36   ` Vlad Yasevich

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).