Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3166883pxu; Mon, 14 Dec 2020 23:43:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYygct5jB0yCps1OcZzZ1eQi7+P3kVokJVwjJ/M2NTjAShXnC1S5PSHUSoDDFuAMLSKWqX X-Received: by 2002:aa7:dc5a:: with SMTP id g26mr28420636edu.35.1608018209748; Mon, 14 Dec 2020 23:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608018209; cv=none; d=google.com; s=arc-20160816; b=GRCnV9uEUu8b4Cxf6cAm/jQ24qA8p+WLFO+Jt2fP7Rqrpn8gaSgirn01pZzUvkBVTP LBqGj9chLkOJXrjPCeaGc8c7QqxUNHSyt5LRFpP1qavZO7PiXra27QwffRZWhap1cAXA fcPEHdVP0pthIX62gNhPFQoVC1I7O5R8ld70Y8A90JTSZgA1LdJPuaCHiH1wXl0UqVWq qxXi8hIaZLeumt1USuMKJbB4I29WbHkBbmBInwlfZBs/XRVvS7x7HX+6H7l/0zgpqjTO TSFMHLQvi52ehf4PTA18ytPmO7SV2wgo7dx2lhn9uRgQRZ0oKH6XgVgFwUs1Z0Bu4PKg yXrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=iLKAWjek/4W2+v50LeSM4P7KejV4Vc5/X8v7QppvPHo=; b=R9HagXtzrD3TWqiNFDSuqDGQi3qnfGn1S3IFrY4m27hOd1+Nd7k1yXBKCyU/xcdryK sIKDvDAGzOM6X9qlL4yl5zXJTe14CTAJjEddU7QnV76wwT3RuR+R5akrydHBbIbJsjKL xksJUhr+hPRfD0M6aK2jxrBDUF2VacE60OaP5AxcCZrpvk+VDRNFnE2e3l2O0YhBd2mp RZFVy6QJwmHKF1U52Wb0Aua795gloYOay4HvdE8u5thDH80DQLwONq3fu3OpS5A3DW06 5EwYs0I9aqIvhG+l9PREWaSovbp/SuEoOGU5ue6HoF8N7t5pAFXV/U3G9Hh7DTsLVx62 s0aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gotplt.org header.s=gotplt.org header.b=BwjDSyAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si444183edr.98.2020.12.14.23.43.06; Mon, 14 Dec 2020 23:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gotplt.org header.s=gotplt.org header.b=BwjDSyAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726699AbgLOHk3 (ORCPT + 99 others); Tue, 15 Dec 2020 02:40:29 -0500 Received: from bee.birch.relay.mailchannels.net ([23.83.209.14]:38274 "EHLO bee.birch.relay.mailchannels.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725816AbgLOHkR (ORCPT ); Tue, 15 Dec 2020 02:40:17 -0500 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 40B239215C4; Tue, 15 Dec 2020 07:30:37 +0000 (UTC) Received: from pdx1-sub0-mail-a35.g.dreamhost.com (100-96-12-130.trex.outbound.svc.cluster.local [100.96.12.130]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id BAB93921CEE; Tue, 15 Dec 2020 07:30:36 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a35.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.11); Tue, 15 Dec 2020 07:30:37 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Reaction-Daffy: 6151692b6aa0cc28_1608017437001_2423627511 X-MC-Loop-Signature: 1608017437001:2334507784 X-MC-Ingress-Time: 1608017437001 Received: from pdx1-sub0-mail-a35.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTP id 77E267F506; Mon, 14 Dec 2020 23:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :cc:references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=QCAl8i KLJYGU7HD3KJQIDIWx7P4=; b=BwjDSyAZkEHsmfJshfS11chqTjfxY3vlVJcxla xnt7HhdVvTsISb3XiqJELflGQBczTS6d2XiZ49SjxalzPYVU9vYhEUn4lGGZ21hw QzGWchcvSXVv/bRGPihptHwrHS+vJwh00Bd7bwwtM0qvI1Ud4Kt8DOkTv95a702F kUVFM= Received: from [192.168.1.111] (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a35.g.dreamhost.com (Postfix) with ESMTPSA id D53F57E357; Mon, 14 Dec 2020 23:30:32 -0800 (PST) Subject: Re: [PATCH] proc: Escape more characters in /proc/mounts output To: Al Viro Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Florian Weimer References: <20201215042454.998361-1-siddhesh@gotplt.org> <20201215061005.GF3579531@ZenIV.linux.org.uk> X-DH-BACKEND: pdx1-sub0-mail-a35 From: Siddhesh Poyarekar Message-ID: <85e8114b-31a5-ccd6-f1e4-5b23a67987d6@gotplt.org> Date: Tue, 15 Dec 2020 13:00:27 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201215061005.GF3579531@ZenIV.linux.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/15/20 11:40 AM, Al Viro wrote: > On Tue, Dec 15, 2020 at 09:54:54AM +0530, Siddhesh Poyarekar wrote: > >> + get_user(byte, (const char __user *)data); >> + >> + return byte ? strndup_user(data, PATH_MAX) : NULL; >> } > > No. Not to mention anything else, you > * fetch the same data twice > * fail to check the get_user() results > Ahh sorry, I could inline the strndup_user call and put an additional check for length == 1 to return NULL. Would that be acceptable? The other alternative would be to not touch copy_mount_string and instead, check after fetching the string and if it is blank, free it and set to NULL. That seems more expensive though. Siddhesh