Skip to content

Commit 906f4a9

Browse files
tlendackykarlhiramoto
authored andcommitted
crypto: scatterwalk - Set the chain pointer indication bit
The scatterwalk_crypto_chain function invokes the scatterwalk_sg_chain function to chain two scatterlists, but the chain pointer indication bit is not set. When the resulting scatterlist is used, for example, by sg_nents to count the number of scatterlist entries, a segfault occurs because sg_nents does not follow the chain pointer to the chained scatterlist. Update scatterwalk_sg_chain to set the chain pointer indication bit as is done by the sg_chain function. Cc: [email protected] Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: Herbert Xu <[email protected]> (cherry picked from commit 41da8b5)
1 parent c0f3044 commit 906f4a9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

include/crypto/scatterwalk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
3636
{
3737
sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
3838
sg1[num - 1].page_link &= ~0x02;
39+
sg1[num - 1].page_link |= 0x01;
3940
}
4041

4142
static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)

0 commit comments

Comments
 (0)