Blob Blame History Raw
From: Denis Kirjanov <denis.kirjanov@suse.com>
Subject: sctp: handle kABI change in struct sctp_endpoint
Patch-mainline: Never, kABI fix
References: CVE-2022-20154 bsc#1200599

Signed-off-by: Denis Kirjanov <denis.kirjanov@suse.com>

---
 include/net/sctp/structs.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1277,7 +1277,9 @@ struct sctp_endpoint {
 	      reconf_enable:1;
 
 	__u8  strreset_enable;
+#ifndef __GENKSYMS__
 	struct rcu_head rcu;
+#endif
 };
 
 /* Recover the outter endpoint structure. */
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -127,6 +127,10 @@ int sctp_transport_lookup_process(int (*
 				  struct net *net,
 				  const union sctp_addr *laddr,
 				  const union sctp_addr *paddr, void *p);
+/* Preserve for KABI compatibility */
+int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
+		          int (*cb_done)(struct sctp_transport *, void *),
+			  struct net *net, int *pos, void *p);
 int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
 				    struct net *net, int *pos, void *p);
 int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *), void *p);
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4711,6 +4711,15 @@ int sctp_transport_lookup_process(int (*
 }
 EXPORT_SYMBOL_GPL(sctp_transport_lookup_process);
 
+int sctp_for_each_transport(int (*cb)(struct sctp_transport *, void *),
+			    int (*cb_done)(struct sctp_transport *, void *),
+			    struct net *net, int *pos, void *p)
+{
+	return sctp_transport_traverse_process((sctp_callback_t)cb,
+			(sctp_callback_t)cb_done, net, pos, p);
+}
+EXPORT_SYMBOL_GPL(sctp_for_each_transport);
+
 int sctp_transport_traverse_process(sctp_callback_t cb, sctp_callback_t cb_done,
 				    struct net *net, int *pos, void *p)
 {