From patchwork Fri Mar 3 22:02:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arseniy Krasnov X-Patchwork-Id: 64116 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp706166wrd; Fri, 3 Mar 2023 16:55:53 -0800 (PST) X-Google-Smtp-Source: AK7set8zsPcG+6b4x4YxwxXPZtFwJMR5diFeOp9tzfWmkutXJZzK2BtFQnSZI9whRSwzMBisSLsq X-Received: by 2002:a50:ee92:0:b0:4c2:96d0:c0cb with SMTP id f18-20020a50ee92000000b004c296d0c0cbmr3963324edr.23.1677891352955; Fri, 03 Mar 2023 16:55:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677891352; cv=none; d=google.com; s=arc-20160816; b=rflrkzlyXJSf14veZHuydB40KlAkU0n9rsSnMBwPmXPMiPYchGPE7rHhSmlzyJcs/V X+oNf9LaCS3dVWS0OUL7C1IkZ3v6yLGg4NHFyiCXX1pIwQIJtaN8PvPhshMzZ1XXXtWm hsfnLoZKmdDHWlGcCvg1DJEcQNCQhDC87pObHkIJZ4DeLXRl/NWjAzD6J6wr5DFDJxHW t4SKbgfszEGG3d9rlNlGdDCQDLBrXrp0izuN+GmJDB5BWZo9p+fGnKqnlaJqAsVMu86W CNa9pUqOTfRIUKqiETj17XAwNKS0IqCkd4vl7NFqBpxNqm+yDW22NXdrbW2JgoyE0J+7 6mRw== 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=e3N0YJ0uSXUIygh8I5oRxE8zPq5uyuoYZQhh7v2tXp4=; b=a1Sg31swIuXjwytMwecuCzdCaA21dTcJDz+9vdtbReavY5mRQa4LlTCmWT5dfP245u Cj2rYAh/cCDQnkdnMu+gm62fCv0SbTm3BrYX7GH/AycqasVQxgWKLf9QjaVZRnPsFwS/ +NwaUVHG69FlNiZq7Ix51FAJpIht8w0ACdHGSIcTowDSvQyV0//vS/hEi/UthKXLo9kq MO9mbido7I3m97qWGh3u2eOi5Hh0jVqpIPYL0nIL92TCHpZ/YJjs/NyH8CjO3uoPSE2k +o0QAl8D+6a/7+L6mZYXYJZptVZ7NQHbsL0587hwE+sfahzxMpUjTvbRKg74GVpJ4SDM UP3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=bEKaIMcF; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc8-20020a1709071c0800b008ddf3c18310si5117564ejc.757.2023.03.03.16.55.29; Fri, 03 Mar 2023 16:55:52 -0800 (PST) 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=bEKaIMcF; 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 S229750AbjCDAD3 (ORCPT + 99 others); Fri, 3 Mar 2023 19:03:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjCDAD1 (ORCPT ); Fri, 3 Mar 2023 19:03:27 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B655FEB50; Fri, 3 Mar 2023 16:03:24 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 64FE45FD2E; Sat, 4 Mar 2023 01:05:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1677881119; bh=e3N0YJ0uSXUIygh8I5oRxE8zPq5uyuoYZQhh7v2tXp4=; h=Message-ID:Date:MIME-Version:To:From:Subject:Content-Type; b=bEKaIMcFKwNSwUf9ShSc9fH+vHOfHn84oXfVs+JOqa0cEqfp4DbzYMC15A03tDHh7 3v8S32KaH1beaxPMyp9BAsCkFOIDPQE3uYbdSi1f91YijkE0i12Sb4P9g/0juaDv7p t+PPLZFt25ogbsBqHiFLgSXQxtnWJyQMWGEr+zGDMnNV0XRoOatBiaFk5NdmwD6Zc+ ZofIZ1tbuPzNdzvdiyYZrj4fsAx+DBzK+696tpxVcqEwjuqL7JZtmtlJya0RUUOKY8 xnr2wdKaseE7+hMynk9xbG8GfX//9I9aFR0SjPKXfDZOEZMjTk7Y6MhRKdrJJFB4n5 4LTocHToMBjEw== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Sat, 4 Mar 2023 01:05:19 +0300 (MSK) Message-ID: Date: Sat, 4 Mar 2023 01:02:29 +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: To: Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bobby Eshleman CC: , , , , , , From: Arseniy Krasnov Subject: [RFC PATCH v1 3/3] virtio/vsock: remove all data from sk_buff X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) 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/03 17:09:00 #20912733 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759396602921647472?= X-GMAIL-MSGID: =?utf-8?q?1759396602921647472?= In case of SOCK_SEQPACKET all sk_buffs are used once - after read some data from it, it will be removed, so user will never read rest of the data. Thus we need to update credit parameters of the socket like whole sk_buff is read - so call 'skb_pull()' for the whole buffer. Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") Signed-off-by: Arseniy Krasnov --- net/vmw_vsock/virtio_transport_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index d80075e1db42..bbcf331b6ad6 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -470,7 +470,7 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk, dequeued_len = err; } else { user_buf_len -= bytes_to_copy; - skb_pull(skb, bytes_to_copy); + skb_pull(skb, skb->len); } spin_lock_bh(&vvs->rx_lock);