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]
Message-ID: <VI1PR0502MB300847394E1E25FADDCC0BB7D1B70@VI1PR0502MB3008.eurprd05.prod.outlook.com>
Date:   Tue, 17 Apr 2018 04:01:06 +0000
From:   Parav Pandit <parav@...lanox.com>
To:     longli <longli@...rosoft.com>, Steve French <sfrench@...ba.org>,
        "linux-cifs@...r.kernel.org" <linux-cifs@...r.kernel.org>,
        "samba-technical@...ts.samba.org" <samba-technical@...ts.samba.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH 2/6] cifs: Allocate validate negoation request through
 kmalloc



> -----Original Message-----
> From: linux-rdma-owner@...r.kernel.org [mailto:linux-rdma-
> owner@...r.kernel.org] On Behalf Of Long Li
> Sent: Monday, April 16, 2018 7:49 PM
> To: Steve French <sfrench@...ba.org>; linux-cifs@...r.kernel.org; samba-
> technical@...ts.samba.org; linux-kernel@...r.kernel.org; linux-
> rdma@...r.kernel.org; stable@...r.kernel.org
> Cc: longli <longli@...rosoft.com>
> Subject: [PATCH 2/6] cifs: Allocate validate negoation request through kmalloc
> 
> From: Long Li <longli@...rosoft.com>
> 
> The data buffer allocated on the stack can't be DMA'ed, and hence can't send
> through RDMA via SMB Direct.
> 
> Fix this by allocating the request on the heap in smb3_validate_negotiate.
> 
Please provide Fixes ("12-letters commit id") "commit string" which introduced this issue and it is getting fixed here, so that other can apply this fix to older versions.

> Signed-off-by: Long Li <longli@...rosoft.com>
> ---
>  fs/cifs/smb2pdu.c | 38 ++++++++++++++++++++++----------------
>  1 file changed, 22 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0f044c4..abbefe2
> 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -730,7 +730,7 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses
> *ses)  int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon
> *tcon)  {
>  	int rc = 0;
> -	struct validate_negotiate_info_req vneg_inbuf;
> +	struct validate_negotiate_info_req *pneg_inbuf;
[..]
 
>  	rc = SMB2_ioctl(xid, tcon, NO_FILE_ID, NO_FILE_ID,
>  		FSCTL_VALIDATE_NEGOTIATE_INFO, true /* is_fsctl */,
> -		(char *)&vneg_inbuf, sizeof(struct
> validate_negotiate_info_req),
> +		(char *)pneg_inbuf, sizeof(struct validate_negotiate_info_req),
>  		(char **)&pneg_rsp, &rsplen);
> 
>  	if (rc != 0) {
>  		cifs_dbg(VFS, "validate protocol negotiate failed: %d\n", rc);
> +		kfree(pneg_inbuf);
>  		return -EIO;
Instead of duplicating code here, please jump to err_rsp_free label. Kfree() takes care to not panic for NULL pointer.
Or for clarity define new label.

>  	}
> 
> @@ -838,12 +842,14 @@ int smb3_validate_negotiate(const unsigned int xid,
> struct cifs_tcon *tcon)
> 
>  	/* validate negotiate successful */
>  	cifs_dbg(FYI, "validate negotiate info successful\n");
> +	kfree(pneg_inbuf);
>  	kfree(pneg_rsp);
>  	return 0;
> 
>  vneg_out:
>  	cifs_dbg(VFS, "protocol revalidation - security settings mismatch\n");
>  err_rsp_free:
> +	kfree(pneg_inbuf);
>  	kfree(pneg_rsp);
>  	return -EIO;
>  }
> --
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" 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