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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 10:30:12 +0000 (12:30 +0200)
commit941b5eefb1f0429da6fe2107aae35a07e5440f76
treec00e6da348ede73e00a348fa1c1d10f3d5fe2e5e
parent337da470bd10a31ec73ef697d3d0a9a18c207cca
cdc_ncm: fix divide-by-zero caused by invalid wMaxPacketSize

[ Upstream commit 3fe4b3351301660653a2bc73f2226da0ebd2b95e ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/usb/cdc_ncm.c