Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp766271lqs; Fri, 14 Jun 2024 05:19:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSEY8Hzps11n8Bq9Ck4AvvCUNmPgNJ1wLUE2KZuhJar9xPee72t5xjXRab2XLgCoDJJz20wS2DD6Y3Q1t3DbgCEjnxg8tc9t4BoXn6Ig== X-Google-Smtp-Source: AGHT+IH8JzmLLdrNablCEl2JXTm1DBllnf3GbSmvDLO8KpQv42RZ66tUVaw93dbByFTqqApZGIJ6 X-Received: by 2002:a17:906:4146:b0:a6e:f7ee:b1f5 with SMTP id a640c23a62f3a-a6f60dc361fmr173013066b.52.1718367580343; Fri, 14 Jun 2024 05:19:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718367580; cv=pass; d=google.com; s=arc-20160816; b=LnF7pM1wAobvJSKTHLpjldCFMxbaeVSCQqWwNFSrgKlcrck3AkgfAZ+Y05BokrZtHq SZ8t5pJRnyH6wTSFe66hNJbOMTb5mn+f2n+vnR8qcOvOlxa+6RaJ3drlWaHFkz92k37X vhEjvEt9ydVdNkD1TePT95layg3cjjAQnzgSAbLjLeiO5Arxbhr49/OQqDYgjS0MOoko AqY7ik6vMttEbLh+iQdSldfpInvaSlCKUmfTYxowbrwH2dZElKclWb/LARuKL7BrWQgz D6z8n2Uofgc10o655YAo3soh/N0kDxJjS2mjUj2AJtZ5Ka19v7h80RjWTYnjo4vJeyc0 xqMg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3e/imXa1PzDT52HGlulJXx434d5MJ4RmFavwExGV0F0=; fh=bUWP3+XK/yOONT8xxt2XuMlU2EY3Rppo0aOxgYNxMgY=; b=b4pZnROspydo2GXVgmecGRET4ajJVno2oolCmEJl6qOAm9Uq6SIm9bvs1DjGU63nYU a93WfFm4zRVxyvSl2cViAa2FHuoPL2sdxUonrnjh9s8Rv+gPudgOPnTnPDu+inz8lMh6 Z4sCuWlE687GdplFiSyG8EVznYO6SvzkKGqVDw4NkuDOiux/jLnIBWTzlZnjWZpE9hmm NJXEtgCw9S3soacAyUD7NfVJP330mBYCbzPSul8mB2PpFF6H3M3d+R049NeGwPYbMPW9 uAg+gK4D1xjW1yBdWSQnGF220ZW/ebSM+nJtoO7ECVrtWmU/y6HPpHZ9lYO60hZ/3ESw mTgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HfKcuYZB; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-214883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56dd682dsi163044866b.383.2024.06.14.05.19.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 05:19:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HfKcuYZB; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-214883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 122DB1F2B2F5 for ; Fri, 14 Jun 2024 12:19:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F7701974F5; Fri, 14 Jun 2024 12:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HfKcuYZB" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EBDD187560; Fri, 14 Jun 2024 12:19:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718367567; cv=none; b=OF/F87qR1owdpldkMvJEoLIncY0NoLG09OnH2vWXyUNaZOMVpZ1GTxMC5/Bxb7C/Ctf30se3PAuuQcaPdN6KJDnud5MeRhVwZyc0T9n7Dpf4xlddXOEsxZQt+RSdSBpqbNYD6wgFEXgBhYDbtQGRBxKLI7aI83QygucD7rYDpCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718367567; c=relaxed/simple; bh=hk2wJWKdWSr6yMdrtnHXWxXOgLKEOsBAss/qBR+wnSg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tZa+di0RJ+yIyRY5FeB+QlG+An6BbC9FOULcRMpn5cDKNrHgsib1rCWggRs3C9NSs7wwFX5DwhbX3Z1ujPMPjZPXSiDLuRsa/w68lkUcftVP9PL7AkThc0DqIDw7um2M+yZGvbs5VZp0dFBiEFyphYl+3zYleJvNZld8kFReGXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HfKcuYZB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9398C2BD10; Fri, 14 Jun 2024 12:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718367567; bh=hk2wJWKdWSr6yMdrtnHXWxXOgLKEOsBAss/qBR+wnSg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HfKcuYZBn5eYIDevNfYrlyJgBJq4po+7lmaIB5gVMh7EKJQ1yhOJhgL6IPidCps0q NrikKCzLyWYop/VlnstmcdHGTGuFRDzPuj3ew9hgzVrxpCHY2DUN7J0LyJ8mSPLRf9 nyWkqZEg3EMdK52YqelrgFQ2ruXmKEa286B5M830= Date: Fri, 14 Jun 2024 14:19:23 +0200 From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Johan Hovold , Alan Stern , Grant Grundler , Yajun Deng , Oliver Neukum , Douglas Anderson Subject: Re: [PATCH 1/4] USB: make to_usb_driver() use container_of_const() Message-ID: <2024061444-open-denote-804b@gregkh> References: <2024061448-manly-universal-00ad@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2024061448-manly-universal-00ad@gregkh> On Fri, Jun 14, 2024 at 02:11:49PM +0200, Greg Kroah-Hartman wrote: > Turns out that we have some const pointers being passed to > to_usb_driver() but were not catching this. Change the macro to > properly propagate the const-ness of the pointer so that we will notice > when we try to write to memory that we shouldn't be writing to. > > This requires fixing up the usb_match_dynamic_id() function as well, > because it can handle a const * to struct usb_driver. > > Cc: Johan Hovold > Cc: Alan Stern > Cc: Grant Grundler > Cc: Yajun Deng > Cc: Oliver Neukum > Cc: Douglas Anderson > Cc: linux-usb@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman > --- > drivers/usb/core/driver.c | 4 ++-- > include/linux/usb.h | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c > index 8e9bafcd62c6..c985a272e552 100644 > --- a/drivers/usb/core/driver.c > +++ b/drivers/usb/core/driver.c > @@ -229,7 +229,7 @@ static void usb_free_dynids(struct usb_driver *usb_drv) > } > > static const struct usb_device_id *usb_match_dynamic_id(struct usb_interface *intf, > - struct usb_driver *drv) > + const struct usb_driver *drv) Oops, this requires a patch that I have not sent out yet that changes the signature of all match() callbacks for busses, that is still winding it's way through the build systems. So I'll hold off on applying any of this until that is accepted, but at least it's good to get this out for review now to see if anyone objects to this series. Also, I've tested this locally and all seems to work properly, but finding good "unit tests" for adding new device ids is hard... thanks, greg k-h