From patchwork Sat Oct 22 07:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1087182wrr; Sat, 22 Oct 2022 00:35:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7kwqUSxVCBk7WWy7TUmz31iO6A922geA8oJwAfSjfQAjLe7JufN4TdZ7UdYnQFm/b2JYXE X-Received: by 2002:a17:902:b907:b0:178:9d11:c978 with SMTP id bf7-20020a170902b90700b001789d11c978mr23147868plb.90.1666424127954; Sat, 22 Oct 2022 00:35:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424127; cv=none; d=google.com; s=arc-20160816; b=Z/V0ErMWiZIWjp4Fz/XyhKAstKIDKVEh/yM3mccEDeGXv1I6vwNCFo5EbYAcncOK0t 4pX9Z/UFFtM55e02x63fs+mF5OoKz7SFWNfoBlYzVEK3WMQ3Go3sHG9Lw5MDyPed5y4H S00mIPdQy0ZYgLYMqPLFbJmiG/cZKh6rlY5Eg4YoaaUmdSzBa5nj1woHZw0GGcQBa+BA +AMkSquVheT14BwER0kVIZzUA5OftOdALTX/WomyieI0oQfIl+nP3As05kS701BscQRz lSScNwYb1ijnTe03cDPwiQxlNH43m1MjRv9U28bYUOsFYod7+EeCNvwG8I1HM7fwEQWJ nPhQ== 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=sCjD4fdHgGXLAjoOV5OjjQt6DErWdd8i9JDY8IsFw5o=; b=PYKz8WWWAl0EqcdRTrRPvjYTrmVvJUR7DJfahSVqj8z60FPbo7NiIH9WjCgpO3kCiA 6+ofd0TbQNRl4iQrDsx4clytyLKvVRLeT0mdtdLPcHXtS8CYKm2jqvy7IvlVYml2wPcK P1JaJ1o3bGuCWYHwHf9n9C15KBi507zoS8VmZajy8YuH/L2ygDOwwYhZeUkRqZXpn90b m8N5zamLTq0eV+dAHkKBU0TZXh59Fw2vxficQvT0+A3mfA7hwLBFD2xNcB4afdYfooqN K4aHQ8dcjl6hJzEeyy6VURj7Oxk9bhU9Gp0PtQ/vw8DIGEtJGCMXkcuKKyxpDkNQOqFH U/6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t4a5HlmZ; 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 n9-20020a170902f60900b0017f73e4af01si11598970plg.298.2022.10.22.00.35.15; Sat, 22 Oct 2022 00:35:27 -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=t4a5HlmZ; 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 S230111AbiJVHe0 (ORCPT + 99 others); Sat, 22 Oct 2022 03:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbiJVHeT (ORCPT ); Sat, 22 Oct 2022 03:34:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67AA3241B3C; Sat, 22 Oct 2022 00:34:11 -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 4B0DE60A5C; Sat, 22 Oct 2022 07:34:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C08DC433C1; Sat, 22 Oct 2022 07:34:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424049; bh=ImQoJW0u2lFxkZslQa97Yh0eN410XO3v29zyD6EWlN4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4a5HlmZ85tvv0+Tqx1m9jSYgRfE6oqg2VSdVeWfgcE+zILz1siDx9qMjJarwYguJ ddX4GxlUb3BkDobjtyHwCEcA2e7nruFC8TC+gVYMF3x5nUzqqkBmOm17rvmVHXOLcd BsQ8fw/lr+O95P4yUc9bsRHUkMUKP4oVuuYqW7IA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.19 013/717] io_uring/net: dont update msg_name if not provided Date: Sat, 22 Oct 2022 09:18:12 +0200 Message-Id: <20221022072417.423138942@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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?1747372345965998280?= X-GMAIL-MSGID: =?utf-8?q?1747372345965998280?= 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/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -5850,7 +5850,8 @@ static int io_setup_async_msg(struct io_ async_msg = req->async_data; 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;