diff --git a/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch b/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch new file mode 100644 index 0000000..bf16821 --- /dev/null +++ b/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch @@ -0,0 +1,52 @@ +From: Vincent Whitchurch +Date: Fri, 19 Nov 2021 13:05:21 +0100 +Subject: af_unix: fix regression in read after shutdown + +Git-commit: f9390b249c90a15a4d9e69fbfb7a53c860b1fcaf +Patch-mainline: v5.16-rc3 +References: bsc#1206476 + +On kernels before v5.15, calling read() on a unix socket after +shutdown(SHUT_RD) or shutdown(SHUT_RDWR) would return the data +previously written or EOF. But now, while read() after +shutdown(SHUT_RD) still behaves the same way, read() after +shutdown(SHUT_RDWR) always fails with -EINVAL. + +This behaviour change was apparently inadvertently introduced as part of +a bug fix for a different regression caused by the commit adding sockmap +support to af_unix, commit 94531cfcbe79c359 ("af_unix: Add +unix_stream_proto for sockmap"). Those commits, for unclear reasons, +started setting the socket state to TCP_CLOSE on shutdown(SHUT_RDWR), +while this state change had previously only been done in +unix_release_sock(). + +Restore the original behaviour. The sockmap tests in +tests/selftests/bpf continue to pass after this patch. + +Fixes: d0c6416bd7091647f60 ("unix: Fix an issue in unix_shutdown causing the other end read/write failures") +Link: https://lore.kernel.org/lkml/20211111140000.GA10779@axis.com/ +Signed-off-by: Vincent Whitchurch +Tested-by: Casey Schaufler +Signed-off-by: David S. Miller +Signed-off-by: Yousaf Kaukab +--- + net/unix/af_unix.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index 78e08e82c08c..b0bfc78e421c 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -2882,9 +2882,6 @@ static int unix_shutdown(struct socket *sock, int mode) + + unix_state_lock(sk); + sk->sk_shutdown |= mode; +- if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && +- mode == SHUTDOWN_MASK) +- sk->sk_state = TCP_CLOSE; + other = unix_peer(sk); + if (other) + sock_hold(other); +-- +2.35.3 + diff --git a/series.conf b/series.conf index 6229d87..af8573d 100644 --- a/series.conf +++ b/series.conf @@ -11922,6 +11922,7 @@ patches.suse/iavf-Fix-deadlock-occurrence-during-resetting-VF-int.patch patches.suse/iavf-Fix-refreshing-iavf-adapter-stats-on-ethtool-re.patch patches.suse/iavf-Fix-VLAN-feature-flags-after-VFR.patch + patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch patches.suse/net-dsa-qca8k-fix-MTU-calculation.patch patches.suse/nfp-checking-parameter-process-for-rx-usecs-tx-usecs.patch patches.suse/net-stmmac-retain-PTP-clock-time-during-SIOCSHWTSTAM.patch