Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1727649rwl; Thu, 30 Mar 2023 00:13:53 -0700 (PDT) X-Google-Smtp-Source: AKy350bJWfDJi5Lz67UMGVwVHbOkGxcrV+nwFKI/jnmtiCryxkfFki1EVUO4axX8eONiNBHZ8GO7 X-Received: by 2002:a05:6402:34c6:b0:502:92d:4f50 with SMTP id w6-20020a05640234c600b00502092d4f50mr1797446edc.1.1680160433363; Thu, 30 Mar 2023 00:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680160433; cv=none; d=google.com; s=arc-20160816; b=g5eHMZgxdtunopk6FMIq8Z5V8z4uQKjuCN2MCulvghNEuqwZRA5BxyOsx8j7eznS9r nJTpnYR/xQK+tQ76J3tAnYF79ORGjgNFBNqp+B0mLytcoKvYrzChgWeXbYwkUOZvFzyQ pvJAw10o8R5otGFDh1ROmtIJI4G1LkYFZe2d5MpFRy49ebsplO0Sr7WJBgjrjUZ8UVZZ /NDrZZMK1XlMgXbwpDtJHqIAPAPUN8WA/bSUhdUTjN1C3KQNvz3wl2fHcQDvC/Sju6tV sywbWVhv2AuD6pi511okY6AnH+83pnVyX4tbxdZ42C1WtNj0aL5Yoh4yF3JEv7Gzc+G5 Uysg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :in-reply-to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=ggY0SHBEDfjLnsfC/RTR6iP6BEUZWncCZMwnfImDKoE=; b=GNc6mvTkWAylTeX4zIla+vgqT+4yonB4lNBBM0J5xkmXIMXfFKOKdmXojyW0TtbL3y N5u3o1aSTIJr9vaNfA7q0Sz/apDG410IKtEu/5locNecaF1RrVwjMV4VD8xvXUuT4Xqz BppyNEgz7GfY0dOgL42HaHbVUSkHeJsLRy7HtYDxwfIwWmM1XIdWsvNfvpiIg+TsS0p7 c95YVrAE23CM3CT1ODC7tt8JHF3gBEVBsnAap7ulA2Wq7TdnMhiUvBr62d4/J31JLEXd nmsxmcApdbrxu1nQ+FK+qmIqulotWO6lqHg+En3VExO5BAX0mONnBKOqRmOclveSyEHj QE+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=oCPL5TtB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020aa7d353000000b00502038c2d09si21329591edr.596.2023.03.30.00.13.26; Thu, 30 Mar 2023 00:13:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=oCPL5TtB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230452AbjC3HLQ (ORCPT + 99 others); Thu, 30 Mar 2023 03:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjC3HLO (ORCPT ); Thu, 30 Mar 2023 03:11:14 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1B972683; Thu, 30 Mar 2023 00:11:01 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 2F7EE5FD25; Thu, 30 Mar 2023 10:11:00 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1680160260; bh=ggY0SHBEDfjLnsfC/RTR6iP6BEUZWncCZMwnfImDKoE=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=oCPL5TtBEAP6W+v408n4Oq4bR+oEtlA6TQwuISu8BhUWeJ6vYR7TImdW1kVlgZs90 duxxYE/X8+6SNYv6N9KpE6FI8GC9n2O/SWi6Ut7VrTOXaGQJYz1+dGZe457in0uZGl y5YIbaOVdN2mC6LDK7Go27pygHxYUh9GFtoyDdTEnv1j7GfrSTYZthmfcIHj4+oYDp 8+Nc/cfKRp3GDDT6aeZzC8HZweFypZwI1O5vV3TZkCceuSj1YQjlDwNlPTV8dCGr+v Ume3wrtNEBiwc2vSiSJl8z2c0aCB7W7pvCVf5pTSGNCD7iitvuwUqLBsC5yjDvQssJ J4AQmuDNWsjnQ== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Thu, 30 Mar 2023 10:11:00 +0300 (MSK) Message-ID: <94d33849-d3c1-7468-72df-f87f897bafd2@sberdevices.ru> Date: Thu, 30 Mar 2023 10:07:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US In-Reply-To: <60abc0da-0412-6e25-eeb0-8e32e3ec21e7@sberdevices.ru> To: Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman , Bryan Tan , Vishnu Dasa CC: , , , , , , , From: Arseniy Krasnov Subject: [RFC PATCH v2 2/3] vsock/vmci: convert VMCI error code to -ENOMEM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH01.sberdevices.ru (172.16.1.4) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) 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/03/30 01:24:00 #21043458 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds conversion of VMCI specific error code to general -ENOMEM. It is needed, because af_vsock.c passes error value returned from transport to the user. Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/vmci_transport.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 36eb16a40745..45de3e75597f 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -1831,10 +1831,17 @@ static ssize_t vmci_transport_stream_dequeue( size_t len, int flags) { + int err; + if (flags & MSG_PEEK) - return vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); + err = vmci_qpair_peekv(vmci_trans(vsk)->qpair, msg, len, 0); else - return vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); + err = vmci_qpair_dequev(vmci_trans(vsk)->qpair, msg, len, 0); + + if (err < 0) + err = -ENOMEM; + + return err; } static ssize_t vmci_transport_stream_enqueue( @@ -1842,7 +1849,13 @@ 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) -- 2.25.1