]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
USB: serial: omninet: fix memory corruption with small endpoint
authorJohan Hovold <johan@kernel.org>
Fri, 22 May 2026 14:20:58 +0000 (16:20 +0200)
committerJohan Hovold <johan@kernel.org>
Sat, 23 May 2026 07:07:30 +0000 (09:07 +0200)
Make sure that the bulk-out buffers are at least as large as the
hardcoded transfer size to avoid user-controlled slab corruption should
a malicious device report a smaller endpoint max packet size than
expected.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/omninet.c

index aa1e9745f96795782dc73efc158da8adcae1ee9c..b59982ed8b25b5e85eefc71667d8855706f8f41a 100644 (file)
 /* This one seems to be a re-branded ZyXEL device */
 #define BT_IGNITIONPRO_ID      0x2000
 
+#define OMNINET_HEADERLEN      4
+#define OMNINET_BULKOUTSIZE    64
+#define OMNINET_PAYLOADSIZE    (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
+
 /* function prototypes */
 static void omninet_process_read_urb(struct urb *urb);
 static int omninet_prepare_write_buffer(struct usb_serial_port *port,
@@ -54,6 +58,7 @@ static struct usb_serial_driver zyxel_omninet_device = {
        .description =          "ZyXEL - omni.net usb",
        .id_table =             id_table,
        .num_bulk_out =         2,
+       .bulk_out_size =        OMNINET_BULKOUTSIZE,
        .calc_num_ports =       omninet_calc_num_ports,
        .port_probe =           omninet_port_probe,
        .port_remove =          omninet_port_remove,
@@ -130,10 +135,6 @@ static void omninet_port_remove(struct usb_serial_port *port)
        kfree(od);
 }
 
-#define OMNINET_HEADERLEN      4
-#define OMNINET_BULKOUTSIZE    64
-#define OMNINET_PAYLOADSIZE    (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
-
 static void omninet_process_read_urb(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;