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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 20 Sep 2016 13:31:24 +0100
From:   Ben Hutchings <ben.hutchings@...ethink.co.uk>
To:     Olaf Hering <olaf@...fle.de>,
        "K. Y. Srinivasan" <kys@...rosoft.com>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Sasha Levin <alexander.levin@...izon.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 4.4 035/192] [PATCH 036/135] tools: hv: report ENOSPC
 errors in hv_fcopy_daemon

On Mon, 2016-09-12 at 18:59 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> [ Upstream commit b4ed5d1682c6613988c2eb1de55df5ac9988afcc ]
> 
> Currently some "Unspecified error 0x80004005" is reported on the Windows
> side if something fails. Handle the ENOSPC case and return
> ERROR_DISK_FULL, which allows at least Copy-VMFile to report a meaning
> full error.
[...]
> @@ -98,14 +100,26 @@ done:
>  static int hv_copy_data(struct hv_do_fcopy *cpmsg)
>  {
>  	ssize_t bytes_written;
> +	int ret = 0;
>  
>  	bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
>  				cpmsg->offset);
>  
> -	if (bytes_written != cpmsg->size)
> -		return HV_E_FAIL;
> +	filesize += cpmsg->size;
> +	if (bytes_written != cpmsg->size) {
> +		switch (errno) {
[...]

If pwrite() returns a non-negative value less than the requested size,
errno is undefined.  You need to keep trying to write the remaining
bytes until it returns -1.

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.


Powered by blists - more mailing lists