7171#define MSR_SPEED (1<<3)
7272#define MSR_LINK (1<<2)
7373
74+ /* USB endpoints */
75+ enum rtl8150_usb_ep {
76+ RTL8150_USB_EP_CONTROL = 0 ,
77+ RTL8150_USB_EP_BULK_IN = 1 ,
78+ RTL8150_USB_EP_BULK_OUT = 2 ,
79+ RTL8150_USB_EP_INT_IN = 3 ,
80+ };
81+
7482/* Interrupt pipe data */
7583#define INT_TSR 0x00
7684#define INT_RSR 0x01
@@ -867,6 +875,13 @@ static int rtl8150_probe(struct usb_interface *intf,
867875 struct usb_device * udev = interface_to_usbdev (intf );
868876 rtl8150_t * dev ;
869877 struct net_device * netdev ;
878+ static const u8 bulk_ep_addr [] = {
879+ RTL8150_USB_EP_BULK_IN | USB_DIR_IN ,
880+ RTL8150_USB_EP_BULK_OUT | USB_DIR_OUT ,
881+ 0 };
882+ static const u8 int_ep_addr [] = {
883+ RTL8150_USB_EP_INT_IN | USB_DIR_IN ,
884+ 0 };
870885
871886 netdev = alloc_etherdev (sizeof (rtl8150_t ));
872887 if (!netdev )
@@ -880,6 +895,13 @@ static int rtl8150_probe(struct usb_interface *intf,
880895 return - ENOMEM ;
881896 }
882897
898+ /* Verify that all required endpoints are present */
899+ if (!usb_check_bulk_endpoints (intf , bulk_ep_addr ) ||
900+ !usb_check_int_endpoints (intf , int_ep_addr )) {
901+ dev_err (& intf -> dev , "couldn't find required endpoints\n" );
902+ goto out ;
903+ }
904+
883905 tasklet_setup (& dev -> tl , rx_fixup );
884906 spin_lock_init (& dev -> rx_pool_lock );
885907
0 commit comments