Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-18 08:26:13 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-18 09:30:37 +0200
commit13b9869088f335db7485982fe894e7fa7b946c9b (patch)
treeadca598600ca8ac49e1bd27adb9c4000047c1d87
parent185825154198bb6f630138a4bf50a2b0a873c045 (diff)
ipv6: use READ_ONCE() for inet->hdrincl as in ipv4
(networking-stable-19_06_09).
-rw-r--r--patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch62
-rw-r--r--series.conf1
2 files changed, 63 insertions, 0 deletions
diff --git a/patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch b/patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch
new file mode 100644
index 0000000000..a398ac32dc
--- /dev/null
+++ b/patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch
@@ -0,0 +1,62 @@
+From: Olivier Matz <olivier.matz@6wind.com>
+Date: Thu, 6 Jun 2019 09:15:18 +0200
+Subject: ipv6: use READ_ONCE() for inet->hdrincl as in ipv4
+Git-commit: 59e3e4b52663a9d97efbce7307f62e4bc5c9ce91
+Patch-mainline: 5.2-rc4
+References: networking-stable-19_06_09
+
+As it was done in commit 8f659a03a0ba ("net: ipv4: fix for a race
+condition in raw_sendmsg") and commit 20b50d79974e ("net: ipv4: emulate
+READ_ONCE() on ->hdrincl bit-field in raw_sendmsg()") for ipv4, copy the
+value of inet->hdrincl in a local variable, to avoid introducing a race
+condition in the next commit.
+
+Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ net/ipv6/raw.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/net/ipv6/raw.c
++++ b/net/ipv6/raw.c
+@@ -779,6 +779,7 @@ static int rawv6_sendmsg(struct sock *sk
+ struct sockcm_cookie sockc;
+ struct ipcm6_cookie ipc6;
+ int addr_len = msg->msg_namelen;
++ int hdrincl;
+ u16 proto;
+ int err;
+
+@@ -792,6 +793,13 @@ static int rawv6_sendmsg(struct sock *sk
+ if (msg->msg_flags & MSG_OOB)
+ return -EOPNOTSUPP;
+
++ /* hdrincl should be READ_ONCE(inet->hdrincl)
++ * but READ_ONCE() doesn't work with bit fields.
++ * Doing this indirectly yields the same result.
++ */
++ hdrincl = inet->hdrincl;
++ hdrincl = READ_ONCE(hdrincl);
++
+ /*
+ * Get and verify the address.
+ */
+@@ -907,7 +915,7 @@ static int rawv6_sendmsg(struct sock *sk
+ fl6.flowi6_oif = np->ucast_oif;
+ security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
+
+- if (inet->hdrincl)
++ if (hdrincl)
+ fl6.flowi6_flags |= FLOWI_FLAG_KNOWN_NH;
+
+ if (ipc6.tclass < 0)
+@@ -930,7 +938,7 @@ static int rawv6_sendmsg(struct sock *sk
+ goto do_confirm;
+
+ back_from_confirm:
+- if (inet->hdrincl)
++ if (hdrincl)
+ err = rawv6_send_hdrinc(sk, msg, len, &fl6, &dst, msg->msg_flags);
+ else {
+ ipc6.opt = opt;
diff --git a/series.conf b/series.conf
index 98a7948660..ca6bc708a5 100644
--- a/series.conf
+++ b/series.conf
@@ -22711,6 +22711,7 @@
patches.fixes/s390-qeth-fix-vlan-attribute-in-bridge_hostnotify-udev-event
patches.suse/Fix-memory-leak-in-sctp_process_init.patch
patches.suse/ethtool-fix-potential-userspace-buffer-overflow.patch
+ patches.suse/ipv6-use-READ_ONCE-for-inet-hdrincl-as-in-ipv4.patch
patches.drivers/net-mvpp2-Use-strscpy-to-handle-stat-strings.patch
patches.fixes/pktgen-do-not-sleep-with-the-thread-lock-held.patch
patches.drivers/hwmon-core-add-thermal-sensors-only-if-dev-of_node-i.patch