From patchwork Wed Oct 19 08:21:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp202080wrs; Wed, 19 Oct 2022 01:39:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5M88kYOf/5y2DknD33JnDpJoUdp6+lgNn+gkKsHL8xwil8O20/2yKssUZOQ1o/DKbPAcLv X-Received: by 2002:aa7:c58a:0:b0:459:1511:6cff with SMTP id g10-20020aa7c58a000000b0045915116cffmr6419062edq.27.1666168792668; Wed, 19 Oct 2022 01:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666168792; cv=none; d=google.com; s=arc-20160816; b=fhcBIT4aCBiVySVivHCGqD4WBWr5GGGwZ2epKq9HgXJer+ySPSVi0SzeWOfT8kLQDV 6o1rSgTpSZNSp3SnxKCtaKUvuwc3uybXz9wdZM/0h8PwNLriwiAFw3Tq7KmbpfApOSwY LoApeNpTRKiVXrufyKNT+p6yGLl5dbBwtQpdM8laLHTvFzWqlJ0/ysZCPVOloseTPi+t Sw1RWCyWpr1ScHdm61PBu6KQkNxxjlbq1OjgrEprRi3cXqXGOdmuVfoc58VGnm377bWl zYrpxCQsnpVxeK/P+mklEvrxVMB72r4CIASajuv6gEIC2Pf7P+xNTDiDrMUM2MlPCZQK 2COw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rjdECyyZ+c4e9zhXoUuHu2Q0zpxW1WG+Lcf7217XDrU=; b=e8fosgy4dV9umGhcP6uRAAj3zvhnWacQdMre/gYhONq1udQgbC5Rbt9zOe3ajPCySo 2hq7/w6ZWWuX+NVU6fiCT5AD3oD8PrNjpwhiGZ2LVXojlaQmL9puJsTZtd4waxacqhQL yuThTYlwd3I1bHCyCmO0cKvHQ4uf+mXgVDniB5Aot58tSDyIBkeapKR1iMNrjkdG2qnl +lk9vbyo97Kd4PdhaUpBwiapELzdyab0t65s//SJE/0KXmqnYWoCG3F6+yRlC15Xfg1K d1yPRVi9I80Jauu3MORnkKgMt8IT0nsz/orafBwLCHUn/3+JYuk+/g2NEatshO6q5vzL NEJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Md3SfXS2; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o9-20020a170906600900b0078054af5eeasi12832143ejj.374.2022.10.19.01.39.28; Wed, 19 Oct 2022 01:39:52 -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=@linuxfoundation.org header.s=korg header.b=Md3SfXS2; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbiJSIjF (ORCPT + 99 others); Wed, 19 Oct 2022 04:39:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229958AbiJSIig (ORCPT ); Wed, 19 Oct 2022 04:38:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD2D781104; Wed, 19 Oct 2022 01:38:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67A9B617DF; Wed, 19 Oct 2022 08:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC1CC4314F; Wed, 19 Oct 2022 08:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168669; bh=TCUsX9pBBpaSnQMGS5JBDj3c0U2M6hs+3F/Ihdd1P4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Md3SfXS2nGKduRpJFAZGWOo+oGOOPoDOi+4MQDBJF7E0sBw/R/M5PwsNCG49kIa4V QOKqp39kzPuFk2o6qx+2cbCCKjH9cWQTE4bF2KB8DiQz6payDjU2ofpLx/NLm6Z7mG 2vFx8XNp+HUR7vtuhUVDDP4Ygj1BRLP1zcTErtTQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 016/862] io_uring/net: dont update msg_name if not provided Date: Wed, 19 Oct 2022 10:21:43 +0200 Message-Id: <20221019083250.727057238@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1747104608250548756?= X-GMAIL-MSGID: =?utf-8?q?1747104608250548756?= From: Pavel Begunkov commit 6f10ae8a155446248055c7ddd480ef40139af788 upstream. io_sendmsg_copy_hdr() may clear msg->msg_name if the userspace didn't provide it, we should retain NULL in this case. Cc: stable@vger.kernel.org Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/97d49f61b5ec76d0900df658cfde3aa59ff22121.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -163,7 +163,8 @@ static int io_setup_async_msg(struct io_ } req->flags |= REQ_F_NEED_CLEANUP; memcpy(async_msg, kmsg, sizeof(*kmsg)); - async_msg->msg.msg_name = &async_msg->addr; + if (async_msg->msg.msg_name) + async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ if (!kmsg->free_iov) { size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov;