3.8.13.14 -stable review patch.  If anyone has any objections, please let me 
know.

------------------

From: Ursula Braun <[email protected]>

commit 6fb392b1a63ae36c31f62bc3fc8630b49d602b62 upstream.

Check user-defined length in snmp ioctl request and allow request
only if it fits into a qeth command buffer.

Signed-off-by: Ursula Braun <[email protected]>
Signed-off-by: Frank Blaschka <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
Reported-by: Nico Golde <[email protected]>
Reported-by: Fabian Yamaguchi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Kamal Mostafa <[email protected]>
---
 drivers/s390/net/qeth_core_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/net/qeth_core_main.c 
b/drivers/s390/net/qeth_core_main.c
index 638a57f..98b60fd 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -4368,7 +4368,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user 
*udata)
        struct qeth_cmd_buffer *iob;
        struct qeth_ipa_cmd *cmd;
        struct qeth_snmp_ureq *ureq;
-       int req_len;
+       unsigned int req_len;
        struct qeth_arp_query_info qinfo = {0, };
        int rc = 0;
 
@@ -4384,6 +4384,10 @@ int qeth_snmp_command(struct qeth_card *card, char 
__user *udata)
        /* skip 4 bytes (data_len struct member) to get req_len */
        if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int)))
                return -EFAULT;
+       if (req_len > (QETH_BUFSIZE - IPA_PDU_HEADER_SIZE -
+                      sizeof(struct qeth_ipacmd_hdr) -
+                      sizeof(struct qeth_ipacmd_setadpparms_hdr)))
+               return -EINVAL;
        ureq = memdup_user(udata, req_len + sizeof(struct qeth_snmp_ureq_hdr));
        if (IS_ERR(ureq)) {
                QETH_CARD_TEXT(card, 2, "snmpnome");
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to