Commit cb6f55af authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two patches in driver frameworks. The iscsi one corrects a bug induced
  by a BPF change to network locking and the other is a regression we
  introduced"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: iscsi: iscsi_tcp: Avoid holding spinlock while calling getpeername()
  scsi: target: Fix lun lookup for TARGET_SCF_LOOKUP_LUN_FROM_TAG case
parents 702bfc89 bcf3a295
...@@ -736,6 +736,7 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, ...@@ -736,6 +736,7 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
struct iscsi_tcp_conn *tcp_conn = conn->dd_data; struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data; struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
struct sockaddr_in6 addr; struct sockaddr_in6 addr;
struct socket *sock;
int rc; int rc;
switch(param) { switch(param) {
...@@ -747,13 +748,17 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn, ...@@ -747,13 +748,17 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
spin_unlock_bh(&conn->session->frwd_lock); spin_unlock_bh(&conn->session->frwd_lock);
return -ENOTCONN; return -ENOTCONN;
} }
sock = tcp_sw_conn->sock;
sock_hold(sock->sk);
spin_unlock_bh(&conn->session->frwd_lock);
if (param == ISCSI_PARAM_LOCAL_PORT) if (param == ISCSI_PARAM_LOCAL_PORT)
rc = kernel_getsockname(tcp_sw_conn->sock, rc = kernel_getsockname(sock,
(struct sockaddr *)&addr); (struct sockaddr *)&addr);
else else
rc = kernel_getpeername(tcp_sw_conn->sock, rc = kernel_getpeername(sock,
(struct sockaddr *)&addr); (struct sockaddr *)&addr);
spin_unlock_bh(&conn->session->frwd_lock); sock_put(sock->sk);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -775,6 +780,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, ...@@ -775,6 +780,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
struct iscsi_tcp_conn *tcp_conn; struct iscsi_tcp_conn *tcp_conn;
struct iscsi_sw_tcp_conn *tcp_sw_conn; struct iscsi_sw_tcp_conn *tcp_sw_conn;
struct sockaddr_in6 addr; struct sockaddr_in6 addr;
struct socket *sock;
int rc; int rc;
switch (param) { switch (param) {
...@@ -789,16 +795,18 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost, ...@@ -789,16 +795,18 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
return -ENOTCONN; return -ENOTCONN;
} }
tcp_conn = conn->dd_data; tcp_conn = conn->dd_data;
tcp_sw_conn = tcp_conn->dd_data; tcp_sw_conn = tcp_conn->dd_data;
if (!tcp_sw_conn->sock) { sock = tcp_sw_conn->sock;
if (!sock) {
spin_unlock_bh(&session->frwd_lock); spin_unlock_bh(&session->frwd_lock);
return -ENOTCONN; return -ENOTCONN;
} }
sock_hold(sock->sk);
spin_unlock_bh(&session->frwd_lock);
rc = kernel_getsockname(tcp_sw_conn->sock, rc = kernel_getsockname(sock,
(struct sockaddr *)&addr); (struct sockaddr *)&addr);
spin_unlock_bh(&session->frwd_lock); sock_put(sock->sk);
if (rc < 0) if (rc < 0)
return rc; return rc;
......
...@@ -1840,7 +1840,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, ...@@ -1840,7 +1840,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
* out unpacked_lun for the original se_cmd. * out unpacked_lun for the original se_cmd.
*/ */
if (tm_type == TMR_ABORT_TASK && (flags & TARGET_SCF_LOOKUP_LUN_FROM_TAG)) { if (tm_type == TMR_ABORT_TASK && (flags & TARGET_SCF_LOOKUP_LUN_FROM_TAG)) {
if (!target_lookup_lun_from_tag(se_sess, tag, &unpacked_lun)) if (!target_lookup_lun_from_tag(se_sess, tag,
&se_cmd->orig_fe_lun))
goto failure; goto failure;
} }
......
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