Commit 4f8b4909 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 iscsi fixes.

  One for an oops in the client which can be triggered by the server
  authentication protocol and the other in the target code which causes
  data corruption"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: iscsi: set auth_protocol back to NULL if CHAP_A value is not supported
  scsi: target/iblock: Fix overrun in WRITE SAME emulation
parents ceacbc0e 5dd6c493
...@@ -81,6 +81,12 @@ static int chap_check_algorithm(const char *a_str) ...@@ -81,6 +81,12 @@ static int chap_check_algorithm(const char *a_str)
return CHAP_DIGEST_UNKNOWN; return CHAP_DIGEST_UNKNOWN;
} }
static void chap_close(struct iscsi_conn *conn)
{
kfree(conn->auth_protocol);
conn->auth_protocol = NULL;
}
static struct iscsi_chap *chap_server_open( static struct iscsi_chap *chap_server_open(
struct iscsi_conn *conn, struct iscsi_conn *conn,
struct iscsi_node_auth *auth, struct iscsi_node_auth *auth,
...@@ -118,7 +124,7 @@ static struct iscsi_chap *chap_server_open( ...@@ -118,7 +124,7 @@ static struct iscsi_chap *chap_server_open(
case CHAP_DIGEST_UNKNOWN: case CHAP_DIGEST_UNKNOWN:
default: default:
pr_err("Unsupported CHAP_A value\n"); pr_err("Unsupported CHAP_A value\n");
kfree(conn->auth_protocol); chap_close(conn);
return NULL; return NULL;
} }
...@@ -133,19 +139,13 @@ static struct iscsi_chap *chap_server_open( ...@@ -133,19 +139,13 @@ static struct iscsi_chap *chap_server_open(
* Generate Challenge. * Generate Challenge.
*/ */
if (chap_gen_challenge(conn, 1, aic_str, aic_len) < 0) { if (chap_gen_challenge(conn, 1, aic_str, aic_len) < 0) {
kfree(conn->auth_protocol); chap_close(conn);
return NULL; return NULL;
} }
return chap; return chap;
} }
static void chap_close(struct iscsi_conn *conn)
{
kfree(conn->auth_protocol);
conn->auth_protocol = NULL;
}
static int chap_server_compute_md5( static int chap_server_compute_md5(
struct iscsi_conn *conn, struct iscsi_conn *conn,
struct iscsi_node_auth *auth, struct iscsi_node_auth *auth,
......
...@@ -502,7 +502,7 @@ iblock_execute_write_same(struct se_cmd *cmd) ...@@ -502,7 +502,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
/* Always in 512 byte units for Linux/Block */ /* Always in 512 byte units for Linux/Block */
block_lba += sg->length >> SECTOR_SHIFT; block_lba += sg->length >> SECTOR_SHIFT;
sectors -= 1; sectors -= sg->length >> SECTOR_SHIFT;
} }
iblock_submit_bios(&list); iblock_submit_bios(&list);
......
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