From 7b1a277680356ee802f0f0abe4617e4a212361b6 Mon Sep 17 00:00:00 2001 From: Salvatore Bonaccorso Date: Thu, 27 Sep 2018 21:20:18 +0200 Subject: [PATCH] scsi: target: iscsi: Use bin2hex instead of a re-implementation --- debian/changelog | 1 + ...i-Use-bin2hex-instead-of-a-re-implem.patch | 62 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 64 insertions(+) create mode 100644 debian/patches/bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch diff --git a/debian/changelog b/debian/changelog index 6560abe6e..51df3518b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -179,6 +179,7 @@ linux (4.18.9-1) UNRELEASED; urgency=medium (CVE-2018-7755) * scsi: target: iscsi: Use hex2bin instead of a re-implementation (CVE-2018-14633) + * scsi: target: iscsi: Use bin2hex instead of a re-implementation -- Vagrant Cascadian Tue, 18 Sep 2018 10:13:18 -0700 diff --git a/debian/patches/bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch b/debian/patches/bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch new file mode 100644 index 000000000..6df88837f --- /dev/null +++ b/debian/patches/bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch @@ -0,0 +1,62 @@ +From: Vincent Pelletier +Date: Sun, 9 Sep 2018 04:09:27 +0000 +Subject: scsi: target: iscsi: Use bin2hex instead of a re-implementation +Origin: https://git.kernel.org/linus/8c39e2699f8acb2e29782a834e56306da24937fe + +Signed-off-by: Vincent Pelletier +Reviewed-by: Mike Christie +Signed-off-by: Martin K. Petersen +--- + drivers/target/iscsi/iscsi_target_auth.c | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + +diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c +index 6c3b4c022894..4e680d753941 100644 +--- a/drivers/target/iscsi/iscsi_target_auth.c ++++ b/drivers/target/iscsi/iscsi_target_auth.c +@@ -26,15 +26,6 @@ + #include "iscsi_target_nego.h" + #include "iscsi_target_auth.h" + +-static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len) +-{ +- int i; +- +- for (i = 0; i < src_len; i++) { +- sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff); +- } +-} +- + static int chap_gen_challenge( + struct iscsi_conn *conn, + int caller, +@@ -50,7 +41,7 @@ static int chap_gen_challenge( + ret = get_random_bytes_wait(chap->challenge, CHAP_CHALLENGE_LENGTH); + if (unlikely(ret)) + return ret; +- chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge, ++ bin2hex(challenge_asciihex, chap->challenge, + CHAP_CHALLENGE_LENGTH); + /* + * Set CHAP_C, and copy the generated challenge into c_str. +@@ -289,7 +280,7 @@ static int chap_server_compute_md5( + goto out; + } + +- chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE); ++ bin2hex(response, server_digest, MD5_SIGNATURE_SIZE); + pr_debug("[server] MD5 Server Digest: %s\n", response); + + if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) { +@@ -411,7 +402,7 @@ static int chap_server_compute_md5( + /* + * Convert response from binary hex to ascii hext. + */ +- chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE); ++ bin2hex(response, digest, MD5_SIGNATURE_SIZE); + *nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s", + response); + *nr_out_len += 1; +-- +2.11.0 + diff --git a/debian/patches/series b/debian/patches/series index f1a54dee4..33d2d9338 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -145,6 +145,7 @@ debian/i386-686-pae-pci-set-pci-nobios-by-default.patch bugfix/all/Revert-net-increase-fragment-memory-usage-limits.patch bugfix/all/floppy-Do-not-copy-a-kernel-pointer-to-user-memory-i.patch bugfix/all/scsi-target-iscsi-Use-hex2bin-instead-of-a-re-implem.patch +bugfix/all/scsi-target-iscsi-Use-bin2hex-instead-of-a-re-implem.patch # Fix exported symbol versions bugfix/all/module-disable-matching-missing-version-crc.patch