lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 04 Jun 2014 16:44:09 -0600
From:	David Ahern <dsahern@...il.com>
To:	Sasha Levin <sasha.levin@...cle.com>, davem@...emloft.net,
	kuznet@....inr.ac.ru, jmorris@...ei.org, yoshfuji@...ux-ipv6.org,
	kaber@...sh.net
CC:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: Revert "fib_trie: use seq_file_net rather than seq->private"

On 6/4/14, 4:11 PM, David Ahern wrote:
> On 6/4/14, 4:02 PM, Sasha Levin wrote:
>> This reverts commit 30f38d2fdd79f13fc929489f7e6e517b4a4bfe63.
>>
>> fib_triestat is surrounded by a big lie: while it claims that it's a
>> seq_file (fib_triestat_seq_open, fib_triestat_seq_show), it isn't:
>>
>>     static const struct file_operations fib_triestat_fops = {
>>             .owner  = THIS_MODULE,
>>             .open   = fib_triestat_seq_open,
>>             .read   = seq_read,
>>             .llseek = seq_lseek,
>>             .release = single_release_net,
>>     };
>>
>> Yes, fib_triestat is just a regular file.

If you compare fib_trie to fib_triestat the only difference is the use 
of single_open_net and single_release_net by fib_triestat.

single_open_net is a wrapper to single_open passing struct net as the 
private data. single_open is for seq_files:


int single_open(struct file *file, int (*show)(struct seq_file *, void *),
         void *data)
{
     struct seq_operations *op = kmalloc(sizeof(*op), GFP_KERNEL);
     int res = -ENOMEM;

     if (op) {
         op->start = single_start;
         op->next = single_next;
         op->stop = single_stop;
         op->show = show;
         res = seq_open(file, op);
         if (!res)
             ((struct seq_file *)file->private_data)->private = data;

Where is the problem using seq_file_net in fib_triestat_seq_show:

static int fib_triestat_seq_show(struct seq_file *seq, void *v)
{
     struct net *net = (struct net *)seq->private;

where

static inline struct net *seq_file_net(struct seq_file *seq)
{
#ifdef CONFIG_NET_NS
     return ((struct seq_net_private *)seq->private)->net;
#else
     return &init_net;
#endif
}

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ