Message ID | 20230413114705.157046-3-kevin.brodsky@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp976136vqo; Thu, 13 Apr 2023 05:00:53 -0700 (PDT) X-Google-Smtp-Source: AKy350aHfAu1QzbuQDmNhd5yG0MYEgGeoubuyL56q32KljaRiG3oseYNxj9JT2ComlkXD8a9tzZH X-Received: by 2002:a05:6a20:4c89:b0:d8:f312:b3b with SMTP id fq9-20020a056a204c8900b000d8f3120b3bmr2033424pzb.3.1681387252964; Thu, 13 Apr 2023 05:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681387252; cv=none; d=google.com; s=arc-20160816; b=UmuIu/K8D8I9hDgrB6b/saYfHW3l/n3fyAz56wOYbHFZ3MwijdUJbYTdr4ahOvX6dy 4/cUuNRnZPATREQPG2cTDvTI9qhV2rZydzA7EwxNgw24a/diPUReEKCCTWo9FE+3rZPx 7dVsebnppbMZEEP6DUNql0C5qx07sUW0fdjU648nRGBXgS+L9wYDBK7njl3SrMQmbY9p zQFMvl8ctWame9R24Hth4om+ZeQ6wb+tCgIQjjcfooNOcD8i33aM407JpKhSzmNsOa8i IKDY5tUSadOpD6U735kfH0J2LVmDaPsw6fx1S4+XT3AYNMR2bMRzpPsWgPyF//B3GGrm XFaw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pCwWEmhODFV1GCAYiZOHwoCnCnyp14wfEjTZBpmh2lA=; b=mLqzeAlN8Jax4LuovkC6xKIC9XCI3uN4aWQiU9ZxKN29EHvRxRFcLIDa5xwatufBM+ sV0JIfC8FNGpUcWqvxg10FnXVV+pKpw2LRk3UU1w2CtRt+Mw1mS4NdE0R7UFtKQCOOse IQZDtirB6OkXoyuOM7insL1ZIMobm4JlF462wRFYW8xzvFbZeIg/1EXDlhtRcX149XvC LV4Vb1TP+Y2ri4LhjqbEmv0+IhgN2xyZJTaGpy+XYbV/Moe1vfkZy7FobDoWSKK4tWPM YymgkaStgRoQwMLjGK3jQiU2PyKUgQ1wJyWQrgXmVY586ZrIgmxT1dQrvisz1/nJ2qb9 GMqA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l24-20020a656818000000b0051b2893b8c0si2053728pgt.548.2023.04.13.05.00.38; Thu, 13 Apr 2023 05:00: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbjDMLsO (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Thu, 13 Apr 2023 07:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjDMLsC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Apr 2023 07:48:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 68B75A5D0; Thu, 13 Apr 2023 04:47:37 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B0E9B13D5; Thu, 13 Apr 2023 04:48:04 -0700 (PDT) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3FFCC3F73F; Thu, 13 Apr 2023 04:47:19 -0700 (PDT) From: Kevin Brodsky <kevin.brodsky@arm.com> To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kevin Brodsky <kevin.brodsky@arm.com>, Christoph Hellwig <hch@lst.de>, Eric Dumazet <edumazet@google.com>, "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org> Subject: [PATCH v2 2/3] net/compat: Update msg_control_is_user when setting a kernel pointer Date: Thu, 13 Apr 2023 12:47:04 +0100 Message-Id: <20230413114705.157046-3-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230413114705.157046-1-kevin.brodsky@arm.com> References: <20230413114705.157046-1-kevin.brodsky@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763062320334114841?= X-GMAIL-MSGID: =?utf-8?q?1763062320334114841?= |
Series |
net: Finish up ->msg_control{,_user} split
|
|
Commit Message
Kevin Brodsky
April 13, 2023, 11:47 a.m. UTC
cmsghdr_from_user_compat_to_kern() is an unusual case w.r.t. how
the kmsg->msg_control* fields are used. The input struct msghdr
holds a pointer to a user buffer, i.e. ksmg->msg_control_user is
active. However, upon success, a kernel pointer is stored in
kmsg->msg_control. kmsg->msg_control_is_user should therefore be
updated accordingly.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---
net/compat.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Thu, Apr 13, 2023 at 12:47:04PM +0100, Kevin Brodsky wrote: > cmsghdr_from_user_compat_to_kern() is an unusual case w.r.t. how > the kmsg->msg_control* fields are used. The input struct msghdr > holds a pointer to a user buffer, i.e. ksmg->msg_control_user is > active. However, upon success, a kernel pointer is stored in > kmsg->msg_control. kmsg->msg_control_is_user should therefore be > updated accordingly. Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/net/compat.c b/net/compat.c index 000a2e054d4c..6564720f32b7 100644 --- a/net/compat.c +++ b/net/compat.c @@ -211,6 +211,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk, goto Einval; /* Ok, looks like we made it. Hook it up and return success. */ + kmsg->msg_control_is_user = false; kmsg->msg_control = kcmsg_base; kmsg->msg_controllen = kcmlen; return 0;