From: Greg Kroah-Hartman Date: Sat, 1 Aug 2020 12:19:31 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.7.13~56 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15beeea5620a82b8e56c70ac773156a0d0c39562;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: wireless-use-offsetof-instead-of-custom-macro.patch --- diff --git a/queue-4.19/series b/queue-4.19/series index 9c16ad9e993..8ba323afc0e 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -11,3 +11,4 @@ sctp-implement-memory-accounting-on-tx-path.patch btrfs-fix-selftests-failure-due-to-uninitialized-i_m.patch pci-aspm-disable-aspm-on-asmedia-asm1083-1085-pcie-to-pci-bridge.patch 9p-trans_fd-fix-concurrency-del-of-req_list-in-p9_fd_cancelled-p9_read_work.patch +wireless-use-offsetof-instead-of-custom-macro.patch diff --git a/queue-4.19/wireless-use-offsetof-instead-of-custom-macro.patch b/queue-4.19/wireless-use-offsetof-instead-of-custom-macro.patch new file mode 100644 index 00000000000..0e033cf7403 --- /dev/null +++ b/queue-4.19/wireless-use-offsetof-instead-of-custom-macro.patch @@ -0,0 +1,67 @@ +From 6989310f5d4327e8595664954edd40a7f99ddd0d Mon Sep 17 00:00:00 2001 +From: Pi-Hsun Shih +Date: Wed, 4 Dec 2019 16:13:07 +0800 +Subject: wireless: Use offsetof instead of custom macro. + +From: Pi-Hsun Shih + +commit 6989310f5d4327e8595664954edd40a7f99ddd0d upstream. + +Use offsetof to calculate offset of a field to take advantage of +compiler built-in version when possible, and avoid UBSAN warning when +compiling with Clang: + +================================================================== +UBSAN: Undefined behaviour in net/wireless/wext-core.c:525:14 +member access within null pointer of type 'struct iw_point' +CPU: 3 PID: 165 Comm: kworker/u16:3 Tainted: G S W 4.19.23 #43 +Workqueue: cfg80211 __cfg80211_scan_done [cfg80211] +Call trace: + dump_backtrace+0x0/0x194 + show_stack+0x20/0x2c + __dump_stack+0x20/0x28 + dump_stack+0x70/0x94 + ubsan_epilogue+0x14/0x44 + ubsan_type_mismatch_common+0xf4/0xfc + __ubsan_handle_type_mismatch_v1+0x34/0x54 + wireless_send_event+0x3cc/0x470 + ___cfg80211_scan_done+0x13c/0x220 [cfg80211] + __cfg80211_scan_done+0x28/0x34 [cfg80211] + process_one_work+0x170/0x35c + worker_thread+0x254/0x380 + kthread+0x13c/0x158 + ret_from_fork+0x10/0x18 +=================================================================== + +Signed-off-by: Pi-Hsun Shih +Reviewed-by: Nick Desaulniers +Link: https://lore.kernel.org/r/20191204081307.138765-1-pihsun@chromium.org +Signed-off-by: Johannes Berg +Signed-off-by: Nick Desaulniers +Signed-off-by: Greg Kroah-Hartman + +--- + include/uapi/linux/wireless.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/include/uapi/linux/wireless.h ++++ b/include/uapi/linux/wireless.h +@@ -74,6 +74,8 @@ + #include /* for "struct sockaddr" et al */ + #include /* for IFNAMSIZ and co... */ + ++#include /* for offsetof */ ++ + /***************************** VERSION *****************************/ + /* + * This constant is used to know the availability of the wireless +@@ -1090,8 +1092,7 @@ struct iw_event { + /* iw_point events are special. First, the payload (extra data) come at + * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, + * we omit the pointer, so start at an offset. */ +-#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ +- (char *) NULL) ++#define IW_EV_POINT_OFF offsetof(struct iw_point, length) + #define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ + IW_EV_POINT_OFF) +