Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp350431pxf; Thu, 8 Apr 2021 04:37:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXvS8wMo7D9+Tx3J4nBhwU/dCGLN4/rSi746n9S+mTp6PYoKCRNjGixD4C8RtibrLpiwXf X-Received: by 2002:a05:6402:31ad:: with SMTP id dj13mr10440266edb.167.1617881826984; Thu, 08 Apr 2021 04:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617881826; cv=none; d=google.com; s=arc-20160816; b=HY9cfVGlkCjQMKcItwtg4VSwEEnbGMB0agWCaljiV5IKXWGlsYapyI0+eByGWVOguQ AS3fXGh91gRLDRWofywadTcj3vHStfCdz8uwZzwX41uCxeI4oS32oBTZw7EjyERQ/N5H 8wbewTiErJjkDWMxAdeTJlUR05o9sXMOlLn457/eUjrGrjXLpFJXfiteFnEVQAraUa6R RigzMmbppJnfiLCJ3Kbtsyqm8iiRcpmevZcnRbimqKXuEddKm+hfcCQGw765ONmtu7e4 cNj37y+PdVPLVUp2G0H/TSVO/IumMlZoS0hgvqRHvVlqBbu9V9IYikujk36KWP4bMrCz 4wtA== 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:date:cc:to:from:subject :message-id:dkim-signature; bh=TLv2wklZKx+07GJDwj8lSKlldFfu0OuL4DATSUU4UTo=; b=jiO3uJBRDBxEr5ACBrhBj/g54eXUAT01mJFgTNxm84r+jrH1TnAtpbi8qFWAUKmV6x CTGnyozl3RTU9iua/cC6Yj+6gK7yvGD2RZLF6NKHTZQN8UgP//KwEBcRFLb+Tv4GxlIb g8WvQMYmYqE0cILm+JmdBTdzqPaALoyO7xOX2jgg+/Pzqb3aOFX0gGPBTO7OyCvs8HfU 25OQj/fhjMuovaRwhT6SkBozg/0dr/0j5IRNn6afILO5JAJb9OfSWb0Fb9uZn962bfT8 vrJAf9f8c7rlaMeXRe5eMJrrWLkvU9hsanJBl2b6Md6Xmh5QPoaZWiSNrBdUqFXM3KeA /xWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Ex4J5UHI; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u25si10466031eds.524.2021.04.08.04.36.44; Thu, 08 Apr 2021 04:37:06 -0700 (PDT) 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=@suse.com header.s=susede1 header.b=Ex4J5UHI; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231240AbhDHLft (ORCPT + 99 others); Thu, 8 Apr 2021 07:35:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:34702 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbhDHLfs (ORCPT ); Thu, 8 Apr 2021 07:35:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617881736; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TLv2wklZKx+07GJDwj8lSKlldFfu0OuL4DATSUU4UTo=; b=Ex4J5UHICowWdEnJtcvwHILgDp7jyv1CjSrRGnx2victzN91ez7X+zqTqzRex7gdNCw7po 7A2ZEc4eYXe00e+P4oLnHnnLItu5VI1HmLenakMuRCUYw6FNudcvFyMX1OupdseuxQz9bx xjuwvIscegu9QpTYdTCLCJuWG7rvNhk= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A467FAE06; Thu, 8 Apr 2021 11:35:36 +0000 (UTC) Message-ID: Subject: Re: [PATCH 2/3] USB: cdc-acm: fix unprivileged TIOCCSERIAL From: Oliver Neukum To: Johan Hovold Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 08 Apr 2021 13:35:24 +0200 In-Reply-To: References: <20210407102845.32720-1-johan@kernel.org> <20210407102845.32720-3-johan@kernel.org> <8918b0b50068705a865ffc22fe9745dacf0c21e8.camel@suse.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, den 08.04.2021, 11:42 +0200 schrieb Johan Hovold: > On Thu, Apr 08, 2021 at 09:48:38AM +0200, Oliver Neukum wrote: > > Am Mittwoch, den 07.04.2021, 12:28 +0200 schrieb Johan Hovold: > > > TIOCSSERIAL is a horrid, underspecified, legacy interface which for most > > > serial devices is only useful for setting the close_delay and > > > closing_wait parameters. > > > > > > A non-privileged user has only ever been able to set the since long > > > deprecated ASYNC_SPD flags and trying to change any other *supported* > > > feature should result in -EPERM being returned. Setting the current > > > values for any supported features should return success. > > > > > > Fix the cdc-acm implementation which instead indicated that the > > > TIOCSSERIAL ioctl was not even implemented when a non-privileged user > > > set the current values. > > > > Hi, > > > > the idea here was that you are setting something else, if you are > > not changing a parameter that can be changed. That conclusion is > > dubious, but at the same time, this implementation can change > > only these two parameters. So can the test really be dropped > > as opposed to be modified? > > The de-facto standard for how to handle change requests for > non-supported features (e.g. changing the I/O port or IRQ) is to simply > ignore them and return 0. > > For most (non-legacy) serial devices the only relevant parameters are > close_delay and closing_wait. And as we need to return -EPERM when a > non-privileged user tries to change these, we cannot drop the test. > > (And returning -EOPNOTSUPP was never correct as the ioctl is indeed > supported.) OK, thanks for clarification. Yes the fix makes sense. Regards Oliver