]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - crypto/dh_helper.c
UBUNTU: SAUCE: media: uvcvideo: Support realtek's UVC 1.5 device
[mirror_ubuntu-artful-kernel.git] / crypto / dh_helper.c
index 708ae20d2d3ccf84280d97e446d350420c828c35..7f00c771fe8d7cee3bbe3d7921fc137bab4c3d40 100644 (file)
@@ -83,6 +83,14 @@ int crypto_dh_decode_key(const char *buf, unsigned int len, struct dh *params)
        if (secret.len != crypto_dh_key_len(params))
                return -EINVAL;
 
+       /*
+        * Don't permit the buffer for 'key' or 'g' to be larger than 'p', since
+        * some drivers assume otherwise.
+        */
+       if (params->key_size > params->p_size ||
+           params->g_size > params->p_size)
+               return -EINVAL;
+
        /* Don't allocate memory. Set pointers to data within
         * the given buffer
         */