mmc: ushc: fix NULL-deref at probe
Subsystems (2)
PATCH 1/1 mmc: ushc: fix NULL-deref at probe
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints.
Fixes 53f3a9e26ed5 ("mmc: USB SD Host Controller (USHC) driver")
Cc stable <[email protected]> # 2.6.37
Cc David Vrabel <[email protected]>
Signed-off-by Johan Hovold <[email protected]>
--- drivers/mmc/host/ushc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/ushc.c +3 -0
@@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *idstruct ushc_data *ushc;int ret; +if (intf->cur_altsetting->desc.bNumEndpoints <1 ) +return -ENODEV ; + mmc =mmc_alloc_host (sizeof (struct ushc_data ), &intf->dev);if (mmc ==NULL )return -ENOMEM ;
Signature · 1 line
2.12.0
Ulf Hansson
AppliedQuoted 7 lines · Johan Hovold
Make sure to check the number of endpoints to avoid dereferencing a NULL-pointer should a malicious device lack endpoints.
Fixes 53f3a9e26ed5 ("mmc: USB SD Host Controller (USHC) driver")Cc stable <[email protected]> # 2.6.37Cc David Vrabel <[email protected]>Signed-off-by Johan Hovold <[email protected]>
Thanks, applied for fixes!
Kind regards
Uffe
Quoted 21 lines
--- drivers/mmc/host/ushc.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mmc/host/ushc.c +3
-1@@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *idstruct ushc_data *ushc;int ret; +if (intf->cur_altsetting->desc.bNumEndpoints <1 ) +return -ENODEV ; + mmc =mmc_alloc_host (sizeof (struct ushc_data ), &intf->dev);if (mmc ==NULL )return -ENOMEM ; --2.12.0