Skip to content

Commit 045007c

Browse files
graysky2hauke
authored andcommitted
cryptodev-linux: add backport to build for 6.18
Add cryptodev-linux/cryptodev-linux@08644db to allow builds against the 6.18 series of kernels. Signed-off-by: John Audia <[email protected]> Link: openwrt/openwrt#21190 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 5393523 commit 045007c

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

package/kernel/cryptodev-linux/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
1111

1212
PKG_NAME:=cryptodev-linux
1313
PKG_VERSION:=1.14
14-
PKG_RELEASE:=1
14+
PKG_RELEASE:=2
1515

1616
PKG_SOURCE_URL:=https://codeload.github.com/$(PKG_NAME)/$(PKG_NAME)/tar.gz/$(PKG_NAME)-$(PKG_VERSION)?
1717
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 08644db02d43478f802755903212f5ee506af73b Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?Joan=20Bruguera=20Mic=C3=B3?= <[email protected]>
3+
Date: Sat, 6 Sep 2025 20:36:38 +0000
4+
Subject: [PATCH] Fix build for Linux 6.18-rc1
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
It's no longer required to use nth_page() when iterating pages within a
10+
single scatterlist entry.
11+
12+
Note I believe this code path in `sg_advance` is currently unreachable:
13+
It is only called from `get_userbuf_srtp`, passing in a scatterlist
14+
copied from one created by `__get_userbuf`, which only generates
15+
entries such that `sg->offset + sg->length <= PAGE_SIZE`.
16+
On the other hand, this code path in `sg_advance` requires that
17+
`sg->offset + sg->length > sg->offset + consumed >= PAGE_SIZE`.
18+
19+
See also: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8f03eb5f0f91fddc9bb8563c7e82bd7d3ba1dd0
20+
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ce00897b94bc5c62fab962625efcf1ab824d3688
21+
22+
Signed-off-by: Joan Bruguera Micó <[email protected]>
23+
---
24+
util.c | 5 +++++
25+
1 file changed, 5 insertions(+)
26+
27+
--- a/util.c
28+
+++ b/util.c
29+
@@ -21,6 +21,7 @@
30+
31+
#include <crypto/scatterwalk.h>
32+
#include <linux/scatterlist.h>
33+
+#include <linux/version.h>
34+
#include "util.h"
35+
36+
/* These were taken from Maxim Levitsky's patch to lkml.
37+
@@ -44,8 +45,12 @@ struct scatterlist *sg_advance(struct sc
38+
sg->length -= consumed;
39+
40+
if (sg->offset >= PAGE_SIZE) {
41+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 18, 0))
42+
+ struct page *page = sg_page(sg) + (sg->offset / PAGE_SIZE);
43+
+#else
44+
struct page *page =
45+
nth_page(sg_page(sg), sg->offset / PAGE_SIZE);
46+
+#endif
47+
sg_set_page(sg, page, sg->length, sg->offset % PAGE_SIZE);
48+
}
49+

0 commit comments

Comments
 (0)