[PATCH OLK-6.6] af_unix: Read 0 bytes with MSG_PEEK loops if last skb is OOB

hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/ICE10B -------------------------------------- recv(0, MSG_PEEK) loops if OOB skb is the last but not first skb in sk_receive_queue, after first skb is peeked, manage_oob() skip OOB skb and set skb = NULL, unix_stream_data_wait() returns immediately and jump to redo label because last != tail, then unix_stream_read_generic() loop forever unless new normal data arrives. The following procedure can reproduce the issue: send(sv[0], "a", 1, 0) send(sv[0], "a", 1, MSG_OOB) recv(sv[1], buf, 0, MSG_PEEK) Fixes: 22dd70eb2c3d ("af_unix: Don't peek OOB data without MSG_OOB.") Signed-off-by: Zhang Changzhong <zhangchangzhong@huawei.com> --- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ab23c8d..26c23f5 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2708,7 +2708,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state, #if IS_ENABLED(CONFIG_AF_UNIX_OOB) if (skb) { skb = manage_oob(skb, sk, flags, copied); - if (!skb && copied) { + if (!skb && (copied || !size)) { unix_state_unlock(sk); break; } -- 2.9.5

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/16711 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/SFR... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/16711 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/SFR...
participants (2)
-
patchwork bot
-
Zhang Changzhong