Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2434103imj; Mon, 11 Feb 2019 02:50:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ/pFJgjPNTa2kaiKAzRFiu9wFwDuR63Q2cIZrHFLhKCYq5EtRFcfcEUousBaLX3S7vtSkP X-Received: by 2002:a63:26c1:: with SMTP id m184mr30959998pgm.367.1549882212308; Mon, 11 Feb 2019 02:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549882212; cv=none; d=google.com; s=arc-20160816; b=Ao2Eh+Zgyy/MvmXA7shdteu7TRhVLV+E9S/UWgw3sQT0HRz+/prj2JtvwCsQGvbYA5 vYGnkL6x/Cwa+Uk3Ijb4DgY+9I6RD9ckq54EATBiwy4FKg9jEDbCK8tsb0hVQGM3KM3r P7dsclbuJv5w8gdfaKTTl8vS85K2YCSxAcuFWLEKW0JDceeg3VjKcCeV1Zp3CjbMnthm Vfv/r4+0/sfqUesajJuIIz8vayT900W1uFD2CEj8UWA9LiGOHPg4+kVxMW6/B8XaDL51 V+JXR1J1hnv28GvXbM6CuD8bsT+w0K6cQSwRPUR4KFER6ZIv8DL+vcqaKxOeGV2dja7f uYbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=2wmk02GtKjaPDPRqCOhbCk6IF2PtUFaj5UsrkbmcNsI=; b=wQcMxqGdLMOdAmCJcgT59mIiA8D1g5L6tICp637vfwNimim1eiR7RbNBrFxWyIaE8+ JP2gSN1exNu7N648d68TlIY+F7Xy8ENxlQB41V6mUSrj2VqZiCp0gIEKAfSdLqz42JqL TI2BAw7G2Jv3pILYqptfNO+Mn0imVGPWIkWm0fSg2gYHAMWFPlsZZRRSA6AI8SzrwXXf +0Z8KNe3ImAQlM/RzQf0xrmeWS63cWodjW+QY0bfLPLYwDOxAWR64YXLhLWvnYu4D8gL nhjQKNRhv7+YyWJqlE8b0734PscisZICCiOtGTJ+3XvwVqhyg/FNJCf+evnF542rkKKU LHzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=WNhfxihI; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si8904858pgv.162.2019.02.11.02.49.56; Mon, 11 Feb 2019 02:50:12 -0800 (PST) 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; dkim=pass header.i=@cisco.com header.s=iport header.b=WNhfxihI; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbfBKKs2 (ORCPT + 99 others); Mon, 11 Feb 2019 05:48:28 -0500 Received: from rcdn-iport-4.cisco.com ([173.37.86.75]:20863 "EHLO rcdn-iport-4.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfBKKs2 (ORCPT ); Mon, 11 Feb 2019 05:48:28 -0500 X-Greylist: delayed 572 seconds by postgrey-1.27 at vger.kernel.org; Mon, 11 Feb 2019 05:48:27 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1566; q=dns/txt; s=iport; t=1549882107; x=1551091707; h=from:to:cc:subject:date:message-id:references: content-transfer-encoding:mime-version; bh=Yjaet96agtBDFV0rdr3iPLaMDx/7V0zcF1VNSs0/h8k=; b=WNhfxihIIIuui08Bs1HFreFMGbJdTGgtRenFsph/RnkGNXSDoER+YMPS kETdv+JLYJlMmIHt2pQT3572HCP/3Ei5CfnQ15AMTyPMKz/fXVLypUCGe 8JoPttKSgp3JS403AzFWps3GK1h4uCncdMHFblBciVcxESWgnR3AMQTRm U=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AEAABnUGFc/5BdJa1jGgEBAQEBAgE?= =?us-ascii?q?BAQEHAgEBAQGBUQUBAQEBCwGCA4FqJwqMFIttgg2CYYZJjmmBewsBAYRsgz0?= =?us-ascii?q?iNAkNAQMBAQIBAQJtKIVLAQUnEzQLEAIBCA4KHhAyJQIEAQ0FCIUGAxWqJTO?= =?us-ascii?q?KJ4xDF4FAP4QjgleCKoVgAoltmH8zCQKPFIMyIYFthUuLKIozhmmKeQIRFIE?= =?us-ascii?q?nHziBVnAVgyeCKBeOHkExi0OBHwEB?= X-IronPort-AV: E=Sophos;i="5.58,358,1544486400"; d="scan'208";a="515938707" Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Feb 2019 10:38:54 +0000 Received: from XCH-ALN-015.cisco.com (xch-aln-015.cisco.com [173.36.7.25]) by rcdn-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id x1BAcsjq016723 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 11 Feb 2019 10:38:54 GMT Received: from xch-aln-012.cisco.com (173.36.7.22) by XCH-ALN-015.cisco.com (173.36.7.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 11 Feb 2019 04:38:54 -0600 Received: from xch-aln-012.cisco.com ([173.36.7.22]) by XCH-ALN-012.cisco.com ([173.36.7.22]) with mapi id 15.00.1395.000; Mon, 11 Feb 2019 04:38:53 -0600 From: "Hans Verkuil (hansverk)" To: Wen Yang , Hans Verkuil , Mauro Carvalho Chehab CC: Linux Media Mailing List , LKML Subject: Re: [PATCH 1/4] media: cec-notifier: fix possible object reference leak Thread-Topic: [PATCH 1/4] media: cec-notifier: fix possible object reference leak Thread-Index: AQHUwCH951ryS7AxYU2IkMLJINPqbQ== Date: Mon, 11 Feb 2019 10:38:53 +0000 Message-ID: <3ed515b78a404ec4a22b5f69ed9d6e28@XCH-ALN-012.cisco.com> References: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.61.175.13] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Outbound-SMTP-Client: 173.36.7.25, xch-aln-015.cisco.com X-Outbound-Node: rcdn-core-8.cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/02/2019 03:48, Wen Yang wrote:=0A= > put_device() should be called in cec_notifier_release(),=0A= > since the dev is being passed down to cec_notifier_get_conn(),=0A= > which holds reference. On cec_notifier destruction, it=0A= > should drop the reference to the device.=0A= > =0A= > Fixes: 6917a7b77413 ("[media] media: add CEC notifier support")=0A= > Signed-off-by: Wen Yang =0A= > ---=0A= > drivers/media/cec/cec-notifier.c | 1 +=0A= > 1 file changed, 1 insertion(+)=0A= > =0A= > diff --git a/drivers/media/cec/cec-notifier.c b/drivers/media/cec/cec-not= ifier.c=0A= > index dd2078b..621d4ae 100644=0A= > --- a/drivers/media/cec/cec-notifier.c=0A= > +++ b/drivers/media/cec/cec-notifier.c=0A= > @@ -66,6 +66,7 @@ static void cec_notifier_release(struct kref *kref)=0A= > container_of(kref, struct cec_notifier, kref);=0A= > =0A= > list_del(&n->head);=0A= > + put_device(n->dev);=0A= > kfree(n->conn);=0A= > kfree(n);=0A= > }=0A= > =0A= =0A= Sorry, no. The dev pointer is just a search key that the notifier code look= s=0A= for. It is not the notifier's responsibility to take a reference, that woul= d=0A= be the responsibility of the hdmi and cec drivers.=0A= =0A= If you can demonstrate that there is an object reference leak, then please= =0A= provide the details: it is likely a bug elsewhere and not in the notifier= =0A= code.=0A= =0A= BTW, your patch series didn't arrive on the linux-media mailinglist for=0A= some reason.=0A= =0A= Regards,=0A= =0A= Hans=0A=