From patchwork Sun Jan 8 20:39:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 13092715 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12361C54EBC for ; Sun, 8 Jan 2023 20:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233996AbjAHUjX (ORCPT ); Sun, 8 Jan 2023 15:39:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbjAHUjL (ORCPT ); Sun, 8 Jan 2023 15:39:11 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F06B7CB; Sun, 8 Jan 2023 12:39:10 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 9FA1F5FD04; Sun, 8 Jan 2023 23:39:08 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1673210348; bh=iOSW3XOkz3vBuWBorAhdOl6FUa5r6JrH7kwqFKyZgWc=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=pyPHzIVXFcJ8xl6A8vXhxv1KudWLzMBJjp1Jz3k6Qq8srPamSkJKvCp8MpTfrRK/m vDrGKqCHHSQgI4Z8iHObErLksM6gJnOdCPyNsbQXRxV3N+zprQbinwrrc4aiHetwBI TQZyKk45ByRcsdi6MobVqBT4AifOVrpyiodmhh0EqHd8eztbE0kNyqNvtNByJat/uH cD4sp3QpXt4x21BFy/25mBKncE4qFKaDhhZ+WoFc+b9Exe1faw2N5gJjsz4NToNgUt 3W4tfovaC9P+9xetYQJPUhPttclj2ajCxXqumptQoyoLN/c+68DC5BNHsVJkdVDuro oiLQQsWq5REBg== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Sun, 8 Jan 2023 23:39:08 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "edumazet@google.com" , "David S. Miller" , "Jakub Kicinski" , Paolo Abeni CC: "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , kernel , Krasnov Arseniy , Arseniy Krasnov , Bobby Eshleman Subject: [PATCH net-next v6 1/4] vsock: return errors other than -ENOMEM to socket Thread-Topic: [PATCH net-next v6 1/4] vsock: return errors other than -ENOMEM to socket Thread-Index: AQHZI6FBMAzTipZPIkK5jsNMAwReeQ== Date: Sun, 8 Jan 2023 20:39:07 +0000 Message-ID: In-Reply-To: <9ad41d2b-bbe9-fe55-3aba-6a1281b6aa1b@sberdevices.ru> Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-ID: MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/01/08 17:38:00 #20747751 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Bobby Eshleman This removes behaviour, where error code returned from any transport was always switched to ENOMEM. For example when user tries to send too big message via SEQPACKET socket, transport layers return EMSGSIZE, but this error code was always replaced with ENOMEM and returned to user. Signed-off-by: Bobby Eshleman Signed-off-by: Arseniy Krasnov Reviewed-by: Stefano Garzarella --- net/vmw_vsock/af_vsock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index d593d5b6d4b1..19aea7cba26e 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1861,8 +1861,9 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, written = transport->stream_enqueue(vsk, msg, len - total_written); } + if (written < 0) { - err = -ENOMEM; + err = written; goto out_err; }