Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2139255rwl; Sat, 1 Apr 2023 02:23:26 -0700 (PDT) X-Google-Smtp-Source: AK7set8Ofi7F2LtSQv7QqEtkltXUN9b33sxx7cqBU1TxuqA/U+7hRn1iKYNvVrl+iIaUOMJoAoe4 X-Received: by 2002:a05:6a20:c11e:b0:d9:4d77:643e with SMTP id bh30-20020a056a20c11e00b000d94d77643emr31714837pzb.4.1680341006084; Sat, 01 Apr 2023 02:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680341006; cv=none; d=google.com; s=arc-20160816; b=edn0Rw5ccXwJImx4AuBs4fE4NM0yaXjwsv5eyEJFnNGI2vWWkv1/gbommk2Hswlxs5 wk+6tHioIQ35Jc+xRf9U8GsNEU3rZXbzYl15XdhcAykNWHdQFNwIC6hMCZobxd7xF81Y YdTzNGPWOZGxkUULald/idABCdrSCKF0StYiJNcC2OZqWgJ8EVAKeab8G0Sp9cgHs1lS XGvL9Lrte53asUfvmKg6W6UA06Lxbz+0CH2GWWQhosPNCF3+8p5/i1L/R27gTQsnKZZs msJmlnW9ei1e0ZcpckSiQZigr0XLaQp49XmeaSP9qkC9Y5XNe6/gbeIGxMaAmZuMUo9N 9oFA== 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=z5LAzYo/jGn8WHAISeszSoJcHXjc+irI502CLJ+Uy98=; b=xcI6MHa7j5q4lYSB/Q3uGYuji8IldoaLqNszXNZr/MNWMiIJidyJ1/PZRzL/9N+7tn uifiozbd1KsI7pCC0tYojBtyZ8rXSGV0h+zjjg+8Xnk2DNWyftH7lWQh8FG1LKgVRwjN wfONezaOiGS7kOhttsP3lOjnYnzCi9zSDST1BCboumBCnCliN6O2B1p3WUjEnL29TmAq Cz6jNrnTjm1D8FHolWa19IcyqmkQFJ3Iglva4XcKem1Weg1Pl18GASWVHaVeJHet48Ve dBHptlDjS/KM5UONp/rJJ+cmKRGiXYy2qg+M04OZBz1VYX+aN4f747L9mzII/Y5q+FbN LIlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=0TXJDBUV; 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 w64-20020a623043000000b00623cc95e511si4397901pfw.117.2023.04.01.02.23.13; Sat, 01 Apr 2023 02:23:26 -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=0TXJDBUV; 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 S229721AbjDAJSZ (ORCPT + 99 others); Sat, 1 Apr 2023 05:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbjDAJSY (ORCPT ); Sat, 1 Apr 2023 05:18:24 -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 5C633AF26; Sat, 1 Apr 2023 02:18:23 -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 E97C160BED; Sat, 1 Apr 2023 09:18:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C73D2C433EF; Sat, 1 Apr 2023 09:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680340702; bh=L/sME2FIr0aX8i+u4x8Bk/GKIj9HRuPD+w8rKgEAVik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=0TXJDBUVkZ+12qcMwHwVgcP21I0COj4wuNnwgFCE+HVhenYDrRiTneLgrVsARzJif YH3BbJAsRF8DNh/K8YW7SG1g/LGTcWM3cPY7wwv1wO47HHVIdrNycjJNhvtUP0Kmzp ZoOgUIRIvI58d/21uLnrwFC3Iy8CHITmSb59luYo= Date: Sat, 1 Apr 2023 11:18:19 +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: <2023040127-untrue-obtrusive-1ea4@gregkh> 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=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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:33:36AM +0200, Greg KH wrote: > 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... I think you got half of the change correctly. This init code is a maze of twisty passages, let me take your patch and tweak it a bit into something that I think should work. This looks to be only a memstick issue, not a driver core issue (which makes me feel better.) thanks, greg k-h