Re: [PATCH 4/11] LTTng-core 0.5.108 : core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Serge E. Hallyn ([email protected]) wrote:
> Hi,
> 
> I'm wondering why this is safe:
> 
> you grab references to the object which may be deleted after
> you drop the transport_list_lock at the top of this block.  Since
> a later patch shows the unregister being called right before the
> owning module is unloaded, that seems awefuly dangerous.
> 
> Is there some other magic going on making this safe?
> 

The ltt_traces_sem mutex is intended to make this safe. However, the transport
separation patch, contributed recently, uses its own transport_list_lock, which
seems to be broken.

I will fix it by using ltt_traces_sem around :


        down(&ltt_traces_sem);
        list_for_each_entry(tran, &ltt_transport_list, node) {
                if (!strcmp(tran->name, trace_type)) {
                        transport = tran;
                        break;
                }
        }

        if (!transport) {
                err = EINVAL;
                printk(KERN_ERR "LTT : Transport %s is not present.\n", trace_type);
                goto trace_error;
        }

        if(!try_module_get(transport->owner)) {
                err = ENODEV;
                printk(KERN_ERR "LTT : Can't lock transport module.\n");
                goto trace_error;
        }
        up(&ltt_traces_sem);

And change the transport_list_lock for ltt_traces_sem everywhere else.

Thanks for spotting this bug,

Mathieu


OpenPGP public key:              http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint:     8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux