fix smb3-encryption breakage when CONFIG_DEBUG_SG=y
We can not use the standard sg_set_buf() fucntion since when CONFIG_DEBUG_SG=y this adds a check that will BUG_ON for cifs.ko when we pass it an object from the stack. Create a new wrapper smb2_sg_set_buf() which avoids doing that particular check and use it for smb3 encryption instead. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com> CC: Stable <stable@vger.kernel.org>
This commit is contained in:
parent
70e80655f5
commit
262916bc69
@ -2066,6 +2066,15 @@ fill_transform_hdr(struct smb2_transform_hdr *tr_hdr, struct smb_rqst *old_rq)
|
|||||||
inc_rfc1001_len(tr_hdr, orig_len);
|
inc_rfc1001_len(tr_hdr, orig_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We can not use the normal sg_set_buf() as we will sometimes pass a
|
||||||
|
* stack object as buf.
|
||||||
|
*/
|
||||||
|
static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
|
||||||
|
unsigned int buflen)
|
||||||
|
{
|
||||||
|
sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
|
||||||
|
}
|
||||||
|
|
||||||
static struct scatterlist *
|
static struct scatterlist *
|
||||||
init_sg(struct smb_rqst *rqst, u8 *sign)
|
init_sg(struct smb_rqst *rqst, u8 *sign)
|
||||||
{
|
{
|
||||||
@ -2080,16 +2089,16 @@ init_sg(struct smb_rqst *rqst, u8 *sign)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sg_init_table(sg, sg_len);
|
sg_init_table(sg, sg_len);
|
||||||
sg_set_buf(&sg[0], rqst->rq_iov[0].iov_base + 24, assoc_data_len);
|
smb2_sg_set_buf(&sg[0], rqst->rq_iov[0].iov_base + 24, assoc_data_len);
|
||||||
for (i = 1; i < rqst->rq_nvec; i++)
|
for (i = 1; i < rqst->rq_nvec; i++)
|
||||||
sg_set_buf(&sg[i], rqst->rq_iov[i].iov_base,
|
smb2_sg_set_buf(&sg[i], rqst->rq_iov[i].iov_base,
|
||||||
rqst->rq_iov[i].iov_len);
|
rqst->rq_iov[i].iov_len);
|
||||||
for (j = 0; i < sg_len - 1; i++, j++) {
|
for (j = 0; i < sg_len - 1; i++, j++) {
|
||||||
unsigned int len = (j < rqst->rq_npages - 1) ? rqst->rq_pagesz
|
unsigned int len = (j < rqst->rq_npages - 1) ? rqst->rq_pagesz
|
||||||
: rqst->rq_tailsz;
|
: rqst->rq_tailsz;
|
||||||
sg_set_page(&sg[i], rqst->rq_pages[j], len, 0);
|
sg_set_page(&sg[i], rqst->rq_pages[j], len, 0);
|
||||||
}
|
}
|
||||||
sg_set_buf(&sg[sg_len - 1], sign, SMB2_SIGNATURE_SIZE);
|
smb2_sg_set_buf(&sg[sg_len - 1], sign, SMB2_SIGNATURE_SIZE);
|
||||||
return sg;
|
return sg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user