Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3042459rwl; Thu, 13 Apr 2023 15:01:49 -0700 (PDT) X-Google-Smtp-Source: AKy350Y4E9txNlCnjGMyZJPh+tn0deeaCRjk/WdinjDTsE712XWoQVsPdisGV+lgBoHR+tyG54Ra X-Received: by 2002:a05:6a20:160f:b0:ec:fd7a:e827 with SMTP id l15-20020a056a20160f00b000ecfd7ae827mr1479071pzj.32.1681423308957; Thu, 13 Apr 2023 15:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681423308; cv=none; d=google.com; s=arc-20160816; b=ugvlAftfZjfuYPt5U3Wqvd9fMKA2snxJQIpaP0CVM8KPMdVAbz9AW3EOpBPr6cudjK vO8cUlriUU0jR1RG7s6ENL9Duwt89XGMF2HevW172xgvRYA5BQAMdDZrza38yBk9ycPr /us/qQ/gOWMbIXZxluYjzA4iogmyBubU5A9+UgYhxxY/+6tqUUZEPyJJHpHzjn5/lg5w YZ++awV+Bnf8sqIg1d3K0hylw/HEJyl6ryt+9RZOk/FOhW2zrAMVqdrKQuiIUY6muOfK ES2/1zNBIYnupEH1uIe1AEwTAKUq2DIBjCFLlbpKQnRHNVFPGLJid6vY79bTKyuktvai Qo1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:to:cc:from:subject:references :in-reply-to:content-transfer-encoding:mime-version:message-id :dkim-signature; bh=7/bdXywXl/dOZ/7jIhm1SCW6JP5tLC54GnHmYApAKR4=; b=DP4iH74FutNL1ey2jQ43jSRSt0tsXSbkIAu6FmfuhJL06s9C3BFFsLszdQY5g+BY++ IYkijWPEKxp35qKqAJsZq77QRgGByz6O0BbZSaoNhGcM6d3RiQkfj1kJlZ8e/FubOxLA Pc/DuSE9O2HGdkoZkVbwLdr1JxCx59qPIrMjfWt+pd3JK2WpG41Ma8Y8sjIZBar1x+dw HVipLY/ZfCGbIV+69se+Pr/sWn0yX0E+VONx6MwcFSUt8wE8XQMvju8hdYNcsIJX4pe1 ICc8J6JFnXLMGzN4d/caQin0sfKnuwQL2YFTfQ0vAcn/rmEXTmmy8vHg4PzMBBU8Eb6r xeIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="i/V6s08x"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s63-20020a632c42000000b0050be799a2fesi2870655pgs.672.2023.04.13.15.01.33; Thu, 13 Apr 2023 15:01:48 -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=@kernel.org header.s=k20201202 header.b="i/V6s08x"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjDMWBJ (ORCPT + 99 others); Thu, 13 Apr 2023 18:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbjDMWBG (ORCPT ); Thu, 13 Apr 2023 18:01:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFF82E77; Thu, 13 Apr 2023 15:01:05 -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 559B3640B2; Thu, 13 Apr 2023 22:01:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70D3EC433D2; Thu, 13 Apr 2023 22:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681423264; bh=hX8CWjMDrFtDXuH/nkcOaymmUtk+GZRIjp0k5IesTvo=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=i/V6s08xML4Y0J15dq94uVDVuL8gdRjWepR6MmGV1lVko7Bmk2514xeJ0xJlWN+Z/ 43r7S06ZT3bTLx3P+Nozh/4CuWb93bkYmz1gNG6QYcp1rgCoSaDG5Tc0DBcH4j5rxq RBMKzHWkC8nqHWwBnx2+OEvjSCSYcNv+CxTaUl5qjoo8MKokHYttKRkUusRjVTJiR1 8XDW4X9a++mNqUKRR0o3RiKh1u1YS9Ic13fFvizDngp0mGR/MenugPciZRniVnopIR lE9E4dAWanytDQeuuBVyuEOg83uLui76/JouO8sZ8dodvkEavlPtY1WQAQMNKy53jp ypHR6jUI8KhbA== Message-ID: <558d22a8848f2f026f272fdc0528424d.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20230413-creamer-overstate-f7ce5a72e437@spud> References: <20230413205528.4044216-1-sboyd@kernel.org> <20230413-creamer-overstate-f7ce5a72e437@spud> Subject: Re: [PATCH] clk: starfive: Avoid casting iomem pointers From: Stephen Boyd Cc: Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, patches@lists.linux.dev, Tommaso Merciai , Emil Renner Berthing , Hal Feng , Conor Dooley , Xingyu Wu To: Conor Dooley Date: Thu, 13 Apr 2023 15:01:02 -0700 User-Agent: alot/0.10 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Quoting Conor Dooley (2023-04-13 14:26:56) > > @@ -335,26 +338,32 @@ static void jh7110_reset_unregister_adev(void *_a= dev) > > struct auxiliary_device *adev =3D _adev; > > =20 > > auxiliary_device_delete(adev); > > + auxiliary_device_uninit(adev); >=20 > Huh, I think you didn't explicitly mention this one, but it's actually > part of the UAF fix AFAICT? >=20 > When I did the aux device stuff for the clk-mpfs driver, I copied from > peci as there were almost no examples of aux dev stuff in-tree. > It looks like subsequently to me starting development, this fix landed: > 1c11289b34ab ("peci: cpu: Fix use-after-free in adev_release()") >=20 > It similarly moves the uninit() to the release callback... >=20 > I think I need the below (whitespace damaged): Yeah that looks better. Care to send a proper patch for it? > diff --git a/drivers/clk/microchip/clk-mpfs.c b/drivers/clk/microchip/clk= -mpfs.c > index 4f0a19db7ed7..cc5d7dee59f0 100644 > --- a/drivers/clk/microchip/clk-mpfs.c > +++ b/drivers/clk/microchip/clk-mpfs.c > @@ -374,14 +374,13 @@ static void mpfs_reset_unregister_adev(void *_adev) > struct auxiliary_device *adev =3D _adev; > =20 > auxiliary_device_delete(adev); > + auxiliary_device_uninit(adev); > } > =20 > static void mpfs_reset_adev_release(struct device *dev) > { > struct auxiliary_device *adev =3D to_auxiliary_dev(dev); > =20 > - auxiliary_device_uninit(adev); > - > kfree(adev); > } >=20 > Anyways, for this patch: > Reviewed-by: Conor Dooley >=20 Thanks.