Skip to content

Commit

Permalink
netfilter: conntrack: don't acquire lock during seq_printf
Browse files Browse the repository at this point in the history
read access doesn't need any lock here.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed Apr 19, 2016
1 parent 4a96300 commit a163f2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions net/netfilter/nf_conntrack_proto_sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,7 @@ static void sctp_print_tuple(struct seq_file *s,
/* Print out the private part of the conntrack. */
static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct)
{
enum sctp_conntrack state;

spin_lock_bh(&ct->lock);
state = ct->proto.sctp.state;
spin_unlock_bh(&ct->lock);

seq_printf(s, "%s ", sctp_conntrack_names[state]);
seq_printf(s, "%s ", sctp_conntrack_names[ct->proto.sctp.state]);
}

#define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \
Expand Down
8 changes: 1 addition & 7 deletions net/netfilter/nf_conntrack_proto_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,13 +313,7 @@ static void tcp_print_tuple(struct seq_file *s,
/* Print out the private part of the conntrack. */
static void tcp_print_conntrack(struct seq_file *s, struct nf_conn *ct)
{
enum tcp_conntrack state;

spin_lock_bh(&ct->lock);
state = ct->proto.tcp.state;
spin_unlock_bh(&ct->lock);

seq_printf(s, "%s ", tcp_conntrack_names[state]);
seq_printf(s, "%s ", tcp_conntrack_names[ct->proto.tcp.state]);
}

static unsigned int get_conntrack_index(const struct tcphdr *tcph)
Expand Down

0 comments on commit a163f2c

Please sign in to comment.