Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2025440rwl; Fri, 31 Mar 2023 23:37:47 -0700 (PDT) X-Google-Smtp-Source: AKy350a8d90+ZL1BDXsfJkQ9XeSAUjUckPxRvTTz+Yk+xRqeWcX5OW1s0c8nS/Jz6g2s+d2sFeLm X-Received: by 2002:a17:903:110c:b0:1a2:1e96:600d with SMTP id n12-20020a170903110c00b001a21e96600dmr9060258plh.2.1680331066808; Fri, 31 Mar 2023 23:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680331066; cv=none; d=google.com; s=arc-20160816; b=yPaII46RGHvdyawFXogndUCwobwccvsJTZBBS0uMRJcFjRFHT9+Flj7l5ys9c0wlDF 9Wh8iRWR1csbbYnKhHsH1m/9kMRbBHcBsgUmka5B/W8hmDfkKBLZ0ODc5K/1oefBUVEM Q73oEPAHOa+3/uFjhk1zuFNEuRTs2kybgNfEx7nyUmaNUCysU6LiNSUwyZPfnGbEuRm8 hxh80aCw8n9f8lUg8fUeQvBoNcO4mM8NHqpJfn2Mi5tfgVCbfBMreKX2yTWOczFwwFWe HfvxvZQPfMhfPm1eeRf3iME2H8wsjQLcg1cYhvfzQl3tlJKSx4oWvAuS6sdPmKkblbAW g48w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IT4ph7Kw92gWXyyb9uNMF+tdAYpPcII1RH2Kt+lUeYY=; b=WxO1jTO4nhfn0AfkAae8mxqI3l8ENGLtP/e4ukfjMZunDrQI0rY6JfrGsBEo4WxI/z 7iIscOSb5O/la8APQayDmaTaEnI2IcQhevYHd+sXWWSuzLh4ewvw498aO+hjDZGoxFIf M7aHPFqBOyJhwADzppHvI8e4d9htX04o5AaAca+dnlzYshMRfARWp/4hET9K+QVxrkjr /sl5aK0xfQdi9UkiZWEQy5//pgKahxTM6m+TfGZh8lNMv7gPf/8jAaqCipFZmlGDC6/P cxvGUWb46ROLXU3Mb0gGDsAzWbXNk0TY45h04y9mBD07dvrRENRj1yY8mjdHJmpppx0H 0vCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A+ZuQgTC; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m5-20020a655645000000b005034a57b4d1si4110931pgs.406.2023.03.31.23.37.35; Fri, 31 Mar 2023 23:37:46 -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=@linuxfoundation.org header.s=korg header.b=A+ZuQgTC; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232478AbjDAGdq (ORCPT + 99 others); Sat, 1 Apr 2023 02:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjDAGdp (ORCPT ); Sat, 1 Apr 2023 02:33:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 211081D85C; Fri, 31 Mar 2023 23:33:42 -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 ams.source.kernel.org (Postfix) with ESMTPS id C1B8EB832B2; Sat, 1 Apr 2023 06:33:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0847EC433EF; Sat, 1 Apr 2023 06:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680330819; bh=d70Vp8SNdPL0Uf4Gb8aXU2perlHFjj5G3Axx7WjxzYk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=A+ZuQgTCa5Qmy2Rxm6+7EV+2kGx6gz+OrviWZhznK9QTPAgPROVDCdahjcBYKZF+w 3kbqR1cdVu8dDF1pZ6Hn68yv5PgsOr8FQs7eKCUi0DLzabBmRrg04o8BBe3Ll8+N74 yQc/lyhvny53egzpRPxslwHxFR+zDizHpJIuL870= Date: Sat, 1 Apr 2023 08:33:36 +0200 From: Greg KH To: Mirsad Goran Todorovac Cc: LKML , Thorsten Leemhuis , Maxim Levitsky , Alex Dubov , Ulf Hansson , Jens Axboe , Christophe JAILLET , Hannes Reinecke , Jiasheng Jiang , ye xingchen , linux-mmc@vger.kernel.org Subject: Re: BUG FIX: [PATCH RFC v3] memstick_check() memleak in kernel 6.1.0+ introduced pre 4.17 Message-ID: References: <7d873dd3-9bab-175b-8158-c458b61a7122@alu.unizg.hr> <2023033124-causing-cassette-4d96@gregkh> <4d80549f-e59d-6319-07fd-1fbed75d7a1c@alu.unizg.hr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Sat, Apr 01, 2023 at 08:28:07AM +0200, Greg KH wrote: > On Sat, Apr 01, 2023 at 08:23:26AM +0200, Mirsad Goran Todorovac wrote: > > > This patch is implying that anyone who calls "dev_set_name()" also has > > > to do this hack, which shouldn't be the case at all. > > > > > > thanks, > > > > > > greg k-h > > > > This is my best guess. Unless there is dev_free_name() or kobject_free_name(), I don't > > see a more sensible way to patch this up. > > In sleeping on this, I think this has to move to the driver core. I > don't understand why we haven't seen this before, except maybe no one > has really noticed before (i.e. we haven't had good leak detection tools > that run with removable devices?) > > Anyway, let me see if I can come up with something this weekend, give me > a chance... Wait, no, this already should be handled by the kobject core, look at kobject_cleanup(), at the bottom. So your change should be merely duplicating the logic there that already runs when the struct device is freed, right? So I don't understand why your change works, odd. I need more coffee... thanks, greg k-h