From patchwork Tue Jan 10 10:13:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 13094937 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 E71AAC54EBE for ; Tue, 10 Jan 2023 10:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbjAJKNh (ORCPT ); Tue, 10 Jan 2023 05:13:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232297AbjAJKN0 (ORCPT ); Tue, 10 Jan 2023 05:13:26 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96C3EC759; Tue, 10 Jan 2023 02:13:25 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 08CBD5FD07; Tue, 10 Jan 2023 13:13:24 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1673345604; bh=iOSW3XOkz3vBuWBorAhdOl6FUa5r6JrH7kwqFKyZgWc=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=YxIMQZyeVu4QYb0mxSG13oEx7g9nNg5nI28Rn5To2pcGD4jlUin9290rMziGxhac+ XbHEDdL7kFqOHSNSEdVbkDemTmFEDIgiN535bdG9/yayiC//YtLY12BWUv8WBLRgJa K6hy+K5Qi4hZfnJagwS2QItRGA96wNmelLO0X0T+w7TC7d4sVReckiQOJn8L4WS4vC a9C1z8Vdf5wlSteoUB1c2Yqx0RC/7Gn0M8huT82BY++gDNHBgIM0VAAS095Ti9aJnr jDxKj8nUK0S+i2YQjcRQTJfTbJuLNBRVqmwgkdox56OEvVTw5ZJQL8IOPH10S9dxGj /40cUKHYC2LBQ== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 10 Jan 2023 13:13:23 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "edumazet@google.com" , "David S. Miller" , Paolo Abeni , Jakub Kicinski CC: "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , Bobby Eshleman , Krasnov Arseniy , "Arseniy Krasnov" , kernel Subject: [PATCH net-next v7 1/4] vsock: return errors other than -ENOMEM to socket Thread-Topic: [PATCH net-next v7 1/4] vsock: return errors other than -ENOMEM to socket Thread-Index: AQHZJNwrTpggmvOgXEC/s2dfrPctDA== Date: Tue, 10 Jan 2023 10:13:23 +0000 Message-ID: <65324bbb-7414-3c27-9dd3-7565010aa6b1@sberdevices.ru> In-Reply-To: <67cd2d0a-1c58-baac-7b39-b8d4ea44f719@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: <32CA6C2BC35ED243A98EBDA9F3BC5DAE@sberdevices.ru> 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/10 08:25:00 #20754977 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; }