From patchwork Fri Nov 25 17:08:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 13056175 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 080DFC4167B for ; Fri, 25 Nov 2022 17:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiKYRIM (ORCPT ); Fri, 25 Nov 2022 12:08:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbiKYRIM (ORCPT ); Fri, 25 Nov 2022 12:08:12 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0852165A8; Fri, 25 Nov 2022 09:08:09 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 1E46B5FD0C; Fri, 25 Nov 2022 20:08:08 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1669396088; bh=KXyYR4VF9sCYOsS3NPi6MuVELIEouxGMJZ8BpfDIAZo=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=cyQDFrMQ8vzelcVlsjJps0cLRUAWlLytI/uP3q6P9R+5SdbJCbaQvZ9W5CFsZinZG oXPE+FxBfkfA98sqOGxND2adWai2xXOoqJxype2JDn4RvKQ0WGTSJa1cf+OVxwXPET M7YLm1wFzcDzkew3sNVRvf+RyL+RAbqVYmWFM0MSMhEvqEOMrde3dVBKl4Tf27CLQo fAXA2NWFMrHZ+0U1q5MHQAtZHnXADT3RRDanIbKJyB8kssS7BzHVmKps4/A8tK+Lrp lHgpvnTbrkVVYuoDx1KVWlDcinJwCV5u/awtMa2LCkStr7Egyuas+d0Azb3kQchsPn ddqI560AwAOHQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Fri, 25 Nov 2022 20:08:06 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , "David S. Miller" , "edumazet@google.com" , "Jakub Kicinski" , Paolo Abeni , "kys@microsoft.com" , "haiyangz@microsoft.com" , "wei.liu@kernel.org" , "Dexuan Cui" , Bryan Tan , Vishnu Dasa , Arseniy Krasnov , "Krasnov Arseniy" , Bobby Eshleman , Bobby Eshleman CC: "linux-kernel@vger.kernel.org" , "netdev@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "linux-hyperv@vger.kernel.org" , kernel Subject: [RFC PATCH v2 3/6] vsock/vmci: always return ENOMEM in case of error Thread-Topic: [RFC PATCH v2 3/6] vsock/vmci: always return ENOMEM in case of error Thread-Index: AQHZAPB8vpTNk9Cz/UiwVhA3FAXi7Q== Date: Fri, 25 Nov 2022 17:08:06 +0000 Message-ID: <675b1f93-dc07-0a70-0622-c3fc6236c8bb@sberdevices.ru> In-Reply-To: <9d96f6c6-1d4f-8197-b3bc-8957124c8933@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: 2022/11/25 14:59:00 #20610704 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 saves original behaviour from af_vsock.c - switch any error code returned from transport layer to ENOMEM. Signed-off-by: Bobby Eshleman Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/vmci_transport.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 842c94286d31..289a36a203a2 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -1838,7 +1838,14 @@ static ssize_t vmci_transport_stream_enqueue( struct msghdr *msg, size_t len) { - return vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg, len, 0); + int err; + + err = vmci_qpair_enquev(vmci_trans(vsk)->qpair, msg, len, 0); + + if (err < 0) + err = -ENOMEM; + + return err; } static s64 vmci_transport_stream_has_data(struct vsock_sock *vsk)