Commit 7cb001d4 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

scsi_tcp: block BH in TCP callbacks

iscsi_sw_tcp_data_ready() and iscsi_sw_tcp_state_change() were
using read_lock(&sk->sk_callback_lock) which is fine if caller
disabled BH.

TCP stack no longer has this requirement and can run from
process context.

Use read_lock_bh() variant to restore previous assumption.

Ideally this code could use RCU instead...

Fixes: 5413d1ba ("net: do not block BH while processing socket backlog")
Fixes: d41a69f1 ("tcp: make tcp_sendmsg() aware of socket backlog")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Mike Christie <michaelc@cs.wisc.edu>
Cc: Venkatesh Srinivas <venkateshs@google.com>
Acked-by: default avatarMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e00be9e4
...@@ -131,10 +131,10 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) ...@@ -131,10 +131,10 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
struct iscsi_tcp_conn *tcp_conn; struct iscsi_tcp_conn *tcp_conn;
read_descriptor_t rd_desc; read_descriptor_t rd_desc;
read_lock(&sk->sk_callback_lock); read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data; conn = sk->sk_user_data;
if (!conn) { if (!conn) {
read_unlock(&sk->sk_callback_lock); read_unlock_bh(&sk->sk_callback_lock);
return; return;
} }
tcp_conn = conn->dd_data; tcp_conn = conn->dd_data;
...@@ -154,7 +154,7 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk) ...@@ -154,7 +154,7 @@ static void iscsi_sw_tcp_data_ready(struct sock *sk)
/* If we had to (atomically) map a highmem page, /* If we had to (atomically) map a highmem page,
* unmap it now. */ * unmap it now. */
iscsi_tcp_segment_unmap(&tcp_conn->in.segment); iscsi_tcp_segment_unmap(&tcp_conn->in.segment);
read_unlock(&sk->sk_callback_lock); read_unlock_bh(&sk->sk_callback_lock);
} }
static void iscsi_sw_tcp_state_change(struct sock *sk) static void iscsi_sw_tcp_state_change(struct sock *sk)
...@@ -165,10 +165,10 @@ static void iscsi_sw_tcp_state_change(struct sock *sk) ...@@ -165,10 +165,10 @@ static void iscsi_sw_tcp_state_change(struct sock *sk)
struct iscsi_session *session; struct iscsi_session *session;
void (*old_state_change)(struct sock *); void (*old_state_change)(struct sock *);
read_lock(&sk->sk_callback_lock); read_lock_bh(&sk->sk_callback_lock);
conn = sk->sk_user_data; conn = sk->sk_user_data;
if (!conn) { if (!conn) {
read_unlock(&sk->sk_callback_lock); read_unlock_bh(&sk->sk_callback_lock);
return; return;
} }
session = conn->session; session = conn->session;
...@@ -179,7 +179,7 @@ static void iscsi_sw_tcp_state_change(struct sock *sk) ...@@ -179,7 +179,7 @@ static void iscsi_sw_tcp_state_change(struct sock *sk)
tcp_sw_conn = tcp_conn->dd_data; tcp_sw_conn = tcp_conn->dd_data;
old_state_change = tcp_sw_conn->old_state_change; old_state_change = tcp_sw_conn->old_state_change;
read_unlock(&sk->sk_callback_lock); read_unlock_bh(&sk->sk_callback_lock);
old_state_change(sk); old_state_change(sk);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment