]> git.baikalelectronics.ru Git - kernel.git/commit
cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize
authorBjørn Mork <bjorn@mork.no>
Wed, 18 Sep 2019 12:01:46 +0000 (14:01 +0200)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Sat, 21 Sep 2019 19:06:49 +0000 (12:06 -0700)
commit1a732e8405a370ffa7838f4721eb0f7fddf6462c
treef93772fd1eeff693a23a52b0a2c978e41b511c8f
parentcfc1e0d245ddde5c69928b3dfebd6ae54027bd19
cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize

Endpoints with zero wMaxPacketSize are not usable for transferring
data. Ignore such endpoints when looking for valid in, out and
status pipes, to make the driver more robust against invalid and
meaningless descriptors.

The wMaxPacketSize of the out pipe is used as divisor. So this change
fixes a divide-by-zero bug.

Reported-by: syzbot+ce366e2b8296e25d84f5@syzkaller.appspotmail.com
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/net/usb/cdc_ncm.c