Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1477406imm; Fri, 7 Sep 2018 00:32:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbgRlMwz0oeAVPpHrA81DVQ5nIXozWJtUXkfJmEmCs1Dva7uXqV71Ed7kStm0nf0Kub1r2G X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr7143552pfm.254.1536305527228; Fri, 07 Sep 2018 00:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536305527; cv=none; d=google.com; s=arc-20160816; b=nVf7juhlIPLIB040NFTS7b+3yj0sMRqx+FLjPZJGrsAHF/hcYeds674ZVp6EGu66xt 52anmOrnvzP8CSAOVdxqcPzVne+B5kR5FooT/UUaJEtVgcuQdE+TVrM2cUkSftEMnvVt 5O1kF687cMxRgNnj+A5ff4eAjHqTQt/6VMnyWxdLJ6kuhDOudlBmlm6YtYbXBdKpzq0x Lkj8/pSVWn1xyzfgwkcgiqUKQ69eP50fm0uQE1NCLLvhpX/DVUJJCydP3pFSs+/ty/XH 8Sc3dXiGGs17z3OKX1K9XDEB2mDTxr2GZUYaK+qBEgwJ34UN4NYya+16b26RM+xuz4RA eaaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=gNgufkEZypQtI8PX7kcCX9kKuTnfDLpiArsjHWo460k=; b=q6p4MizMWAZWfxV99rXcucPJxyHDdaxbFOV2Y0TVoctsIBMw8/BOzxLXO0Jirifl9U HnLHECoRWeWLSDGgTXzpFTRKV0dPr+QJbDVgTtbEasIkDknaBNbH8z7XdV2pxSQ87BV0 uMrAmGC7VyCZpBG7iCrb9LDb+UvwfNzsFsHSNxMqiPvYlTieNIvNOqZOopOvSIc3NkmQ fUc31DEBflLOFmiKVtmArGKpQZRNu1rFTuG2VrP9gFqfDr56dGrW76uoZ2W0FsruXf86 Aw2TAaL05P2JvI2I8vvC/IPeBowbZrQPpmepAZMuvvGLSMDuMKS4qLKyCi8OjM8m/dui JqQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u2-v6si7100687pge.585.2018.09.07.00.31.51; Fri, 07 Sep 2018 00:32:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726587AbeIGMAe (ORCPT + 99 others); Fri, 7 Sep 2018 08:00:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34476 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbeIGMAe (ORCPT ); Fri, 7 Sep 2018 08:00:34 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BFA16D60; Fri, 7 Sep 2018 07:20:59 +0000 (UTC) Date: Fri, 7 Sep 2018 09:20:56 +0200 From: Greg Kroah-Hartman To: Linus Torvalds Cc: dingxiang@cmss.chinamobile.com, Staging subsystem List , martyn@welchs.me.uk, manohar.vanga@gmail.com, Linux Kernel Mailing List Subject: Re: [PATCH] vme: remove unneeded kfree Message-ID: <20180907072056.GB1334@kroah.com> References: <1536223870-6324-1-git-send-email-dingxiang@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 06, 2018 at 10:04:49PM -0700, Linus Torvalds wrote: > On Thu, Sep 6, 2018 at 1:51 AM Ding Xiang > wrote: > > > > put_device will call vme_dev_release to free vdev, kfree is > > unnecessary here. > > That does seem to be the case. I think "unnecessary" is overly kind, > it does seem to be a double free. > > Looks like the issue was introduced back in 2013 by commit > def1820d25fa ("vme: add missing put_device() after device_register() > fails"). > > It seems you should *either* kfree() the vdev, _or_ do put_device(), > but doing both seems wrong. You should only ever call put_device() after you have created the structure, the documentation should say that somewhere... > I presume the device_register() has never failed, and this being > vme-only I'm guessing there isn't a vibrant testing community. > > Greg? It's the correct fix, I'll queue it up soon, thanks. greg k-h