> Subject: RE: [PATCH 2/6] cifs: Allocate validate negoation request through > kmalloc > > > > > -----Original Message----- > > From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma- > > owner@xxxxxxxxxxxxxxx] On Behalf Of Long Li > > Sent: Monday, April 16, 2018 7:49 PM > > To: Steve French <sfrench@xxxxxxxxx>; linux-cifs@xxxxxxxxxxxxxxx; > > samba- technical@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux- > > rdma@xxxxxxxxxxxxxxx; stable@xxxxxxxxxxxxxxx > > Cc: longli <longli@xxxxxxxxxxxxx> > > Subject: [PATCH 2/6] cifs: Allocate validate negoation request through > > kmalloc > > > > From: Long Li <longli@xxxxxxxxxxxxx> > > > > 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. Will do. > > > Signed-off-by: Long Li <longli@xxxxxxxxxxxxx> > > --- > > 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. I will fix this. > > > } > > > > @@ -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@xxxxxxxxxxxxxxx More > majordomo > > info at > > > https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger.k > > ernel.org%2Fmajordomo- > info.html&data=02%7C01%7Clongli%40microsoft.com% > > > 7Cc8c0b791819745b7403408d5a417d9d2%7C72f988bf86f141af91ab2d7cd011d > b47% > > > 7C1%7C0%7C636595344704783010&sdata=99vU6g%2FE5b8TG8Dn2MngmNw > pP5MghgdoV > > hBf0sak%2B0w%3D&reserved=0