summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUrsula Braun <ursula.braun@de.ibm.com>2013-11-06 08:04:52 +0000
committerWilly Tarreau <w@1wt.eu>2014-05-19 07:54:34 +0200
commit857c509645568201e67c3566a8293fd7b9e7cf94 (patch)
tree262502e3a664a85a6f8b8816341c08036be6ca00
parente3123670efb2e10e536fa7fe752d72a4ca5bce9a (diff)
downloadlinux-stable-857c509645568201e67c3566a8293fd7b9e7cf94.tar.gz
linux-stable-857c509645568201e67c3566a8293fd7b9e7cf94.tar.bz2
linux-stable-857c509645568201e67c3566a8293fd7b9e7cf94.zip
qeth: avoid buffer overflow in snmp ioctl
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 <ursula.braun@de.ibm.com> Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com> Reviewed-by: Heiko Carstens <heicars2@linux.vnet.ibm.com> Reported-by: Nico Golde <nico@ngolde.de> Reported-by: Fabian Yamaguchi <fabs@goesec.de> Cc: <stable@vger.kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> [jmm: backport 2.6.32] Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--drivers/s390/net/qeth_core_main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index c4a42d970158..29afd6c5c543 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -3557,7 +3557,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;
@@ -3573,6 +3573,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 = kmalloc(req_len+sizeof(struct qeth_snmp_ureq_hdr), GFP_KERNEL);
if (!ureq) {
QETH_DBF_TEXT(TRACE, 2, "snmpnome");