lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 19 Aug 2015 14:03:19 +0200
From:	Bjørn Mork <bjorn@...k.no>
To:	Vivek Kumar Bhagat <vivek.bhagat@...sung.com>
Cc:	netdev@...r.kernel.org, nitin.j@...sung.com, hemanshu.s@...sung.com
Subject: Re: [PATCH] usbnet: dereference after null check in usbnet_start_xmit() and __usbnet_read_cmd()

Bjørn Mork <bjorn@...k.no> writes:
> Vivek Kumar Bhagat <vivek.bhagat@...sung.com> writes:
>
>> @@ -1906,7 +1908,8 @@ static int __usbnet_read_cmd(struct usbnet *dev, u8 cmd, u8 reqtype,
>>  		buf = kmalloc(size, GFP_KERNEL);
>>  		if (!buf)
>>  			goto out;
>> -	}
>> +	} else
>> +		goto out;
>>  
>>  	err = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
>>  			      cmd, reqtype, value, index, buf, size,
>
>
> This is also wrong.  It makes __usbnet_read_cmd() return -ENOMEM if
> called with a NULL data pointer.  I don't know if it is used, but it's
> perfectly valid to call __usbnet_read_cmd() with data == NULL if
> size == 0. No memcpy will happen in this case because usb_control_msg
> can only return 0 or an error

Just for the record - a simple grep for usbnet_read_cmd shows that at
least drivers/net/usb/plusb.c depends on the current behaviour:

static inline int
pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
{
        return usbnet_read_cmd(dev, req,
                                USB_DIR_IN | USB_TYPE_VENDOR |
                                USB_RECIP_DEVICE,
                                val, index, NULL, 0);
}



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ