Skip to content

Commit cb6f55a

Browse files
committed
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
2 parents 702bfc8 + bcf3a29 commit cb6f55a

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

drivers/scsi/iscsi_tcp.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
736736
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
737737
struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
738738
struct sockaddr_in6 addr;
739+
struct socket *sock;
739740
int rc;
740741

741742
switch(param) {
@@ -747,13 +748,17 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
747748
spin_unlock_bh(&conn->session->frwd_lock);
748749
return -ENOTCONN;
749750
}
751+
sock = tcp_sw_conn->sock;
752+
sock_hold(sock->sk);
753+
spin_unlock_bh(&conn->session->frwd_lock);
754+
750755
if (param == ISCSI_PARAM_LOCAL_PORT)
751-
rc = kernel_getsockname(tcp_sw_conn->sock,
756+
rc = kernel_getsockname(sock,
752757
(struct sockaddr *)&addr);
753758
else
754-
rc = kernel_getpeername(tcp_sw_conn->sock,
759+
rc = kernel_getpeername(sock,
755760
(struct sockaddr *)&addr);
756-
spin_unlock_bh(&conn->session->frwd_lock);
761+
sock_put(sock->sk);
757762
if (rc < 0)
758763
return rc;
759764

@@ -775,6 +780,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
775780
struct iscsi_tcp_conn *tcp_conn;
776781
struct iscsi_sw_tcp_conn *tcp_sw_conn;
777782
struct sockaddr_in6 addr;
783+
struct socket *sock;
778784
int rc;
779785

780786
switch (param) {
@@ -789,16 +795,18 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
789795
return -ENOTCONN;
790796
}
791797
tcp_conn = conn->dd_data;
792-
793798
tcp_sw_conn = tcp_conn->dd_data;
794-
if (!tcp_sw_conn->sock) {
799+
sock = tcp_sw_conn->sock;
800+
if (!sock) {
795801
spin_unlock_bh(&session->frwd_lock);
796802
return -ENOTCONN;
797803
}
804+
sock_hold(sock->sk);
805+
spin_unlock_bh(&session->frwd_lock);
798806

799-
rc = kernel_getsockname(tcp_sw_conn->sock,
807+
rc = kernel_getsockname(sock,
800808
(struct sockaddr *)&addr);
801-
spin_unlock_bh(&session->frwd_lock);
809+
sock_put(sock->sk);
802810
if (rc < 0)
803811
return rc;
804812

drivers/target/target_core_transport.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
18401840
* out unpacked_lun for the original se_cmd.
18411841
*/
18421842
if (tm_type == TMR_ABORT_TASK && (flags & TARGET_SCF_LOOKUP_LUN_FROM_TAG)) {
1843-
if (!target_lookup_lun_from_tag(se_sess, tag, &unpacked_lun))
1843+
if (!target_lookup_lun_from_tag(se_sess, tag,
1844+
&se_cmd->orig_fe_lun))
18441845
goto failure;
18451846
}
18461847

0 commit comments

Comments
 (0)