This is a note to let you know that I've just added the patch titled

    SCSI: qla4xxx: overflow in qla4xxx_set_chap_entry()

to the 3.13-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-qla4xxx-overflow-in-qla4xxx_set_chap_entry.patch
and it can be found in the queue-3.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 3c60cfd73966797746530768d66597d025a69804 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Wed, 13 Nov 2013 10:48:11 +0300
Subject: SCSI: qla4xxx: overflow in qla4xxx_set_chap_entry()

From: Dan Carpenter <[email protected]>

commit 3c60cfd73966797746530768d66597d025a69804 upstream.

We should cap the size of memcpy() because it comes from the network
and can't be trusted.

Fixes: 26ffd7b45fe9 ('[SCSI] qla4xxx: Add support to set CHAP entries')
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Vikas Chaudhary <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/scsi/qla4xxx/ql4_os.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -802,6 +802,7 @@ static int qla4xxx_set_chap_entry(struct
        int type;
        int rem = len;
        int rc = 0;
+       int size;
 
        memset(&chap_rec, 0, sizeof(chap_rec));
 
@@ -816,12 +817,14 @@ static int qla4xxx_set_chap_entry(struct
                        chap_rec.chap_type = param_info->value[0];
                        break;
                case ISCSI_CHAP_PARAM_USERNAME:
-                       memcpy(chap_rec.username, param_info->value,
-                              param_info->len);
+                       size = min_t(size_t, sizeof(chap_rec.username),
+                                    param_info->len);
+                       memcpy(chap_rec.username, param_info->value, size);
                        break;
                case ISCSI_CHAP_PARAM_PASSWORD:
-                       memcpy(chap_rec.password, param_info->value,
-                              param_info->len);
+                       size = min_t(size_t, sizeof(chap_rec.password),
+                                    param_info->len);
+                       memcpy(chap_rec.password, param_info->value, size);
                        break;
                case ISCSI_CHAP_PARAM_PASSWORD_LEN:
                        chap_rec.password_length = param_info->value[0];


Patches currently in stable-queue which might be from [email protected] 
are

queue-3.13/zram-fix-race-between-reset-and-flushing-pending-work.patch
queue-3.13/alsa-bits-vs-bytes-bug-in-snd_card_create.patch
queue-3.13/scsi-qla4xxx-overflow-in-qla4xxx_set_chap_entry.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to