From patchwork Tue Dec 6 20:49:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 13066267 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 3F3DEC3A5A7 for ; Tue, 6 Dec 2022 20:49:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229702AbiLFUtZ (ORCPT ); Tue, 6 Dec 2022 15:49:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbiLFUtX (ORCPT ); Tue, 6 Dec 2022 15:49:23 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25F8043AD2; Tue, 6 Dec 2022 12:49:22 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 8CF5C5FD0B; Tue, 6 Dec 2022 23:49:20 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1670359760; bh=0st0OtNKvLNHxb42ZDSNL0oBxw5QegXYyh0QDx6NkXU=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=YJ90tUWKjberRXpA+lsN5hE4pGiZvV+nDpV2/2Yf8p/JvpNIRIxX0M+Bf9rzsci5R 7OYXOK8yioTIH9pxu+x7rnUbAoP8Sl2rHVYE8lBAIEx7bQX2JyAIYeCoSj7IRMqbbE BVNx/6Y6e7f3PAGXsCVY6F3sALeSX2HHTw2Sk7BEn/EHNzREY36yeH67Wi9iDtIc1E /Fcd+8cVPI08cPWEB90rtMFg73JQdpTmaJRSjCZuxKvLFmQNj5u2S6jWSMpKf02pQQ l3rviQmGnFdUMQz1DLFp32BlJd17ziCgEepuqUHP5nReCvFtGy7TIWHEAEG1UwZTQf oLUcvT7Mf6BpA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 6 Dec 2022 23:49:20 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "edumazet@google.com" , Jakub Kicinski , "David S. Miller" , Paolo Abeni CC: Bobby Eshleman , Arseniy Krasnov , Krasnov Arseniy , "linux-kernel@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel Subject: [RFC PATCH v4 1/4] vsock: return errors other than -ENOMEM to socket Thread-Topic: [RFC PATCH v4 1/4] vsock: return errors other than -ENOMEM to socket Thread-Index: AQHZCbQ2qBrFeLHJokud7/6u9taBOw== Date: Tue, 6 Dec 2022 20:49:19 +0000 Message-ID: <727f2c9e-a909-a3d3-c04f-a16529df7bb2@sberdevices.ru> In-Reply-To: <6be11122-7cf2-641f-abd8-6e379ee1b88f@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: <05667300B7E0DB499FEA5DE844DEF0F9@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: 2022/12/06 12:14:00 #20663216 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-State: RFC 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 will be replaced to 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 884eca7f6743..61ddab664c33 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1862,8 +1862,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; }