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:	Mon, 26 May 2014 08:57:55 -0400
From:	Paul Clements <paul.clements@...sios.com>
To:	Hani Benhabiles <kroosec@...il.com>
Cc:	"nbd-general@...ts.sourceforge.net" 
	<nbd-general@...ts.sourceforge.net>,
	kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2] nbd: Zero from and len fields in NBD_CMD_DISCONNECT.

On Sun, May 25, 2014 at 6:22 PM, Hani Benhabiles <kroosec@...il.com> wrote:
> Len field is already set to zero, but not the from field which is sent as
> 0xfffffffffffffe00. This makes no sense, and may cause confuse server
> implementations doing sanity checks (qemu-nbd is an example.)
>
> Signed-off-by: Hani Benhabiles <hani@...ux.com>
> ---
>
> Compared to v1:
> * Zero the request structure instead of conditionally zeroing specific fields.


Yeah, this one looks good. Sorry for the confusion on the structs...


>  drivers/block/nbd.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 3a70ea2..8e1df52 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -243,14 +243,11 @@ static int nbd_send_req(struct nbd_device *nbd, struct request *req)
>         struct nbd_request request;
>         unsigned long size = blk_rq_bytes(req);
>
> +       memset(&request, 0, sizeof(request));
>         request.magic = htonl(NBD_REQUEST_MAGIC);
>         request.type = htonl(nbd_cmd(req));
>
> -       if (nbd_cmd(req) == NBD_CMD_FLUSH) {
> -               /* Other values are reserved for FLUSH requests.  */
> -               request.from = 0;
> -               request.len = 0;
> -       } else {
> +       if (nbd_cmd(req) != NBD_CMD_FLUSH && nbd_cmd(req) != NBD_CMD_DISC) {
>                 request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
>                 request.len = htonl(size);
>         }
> --
> 1.8.3.2
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ