Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp2099882pxy; Sat, 24 Apr 2021 05:14:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyINsQ4l1vXm0oGja7F9YOS/8n6RGNDLS+CGKZ8oIUAOrN/uRVRIVhZVk1MDi0IZC2v4tkz X-Received: by 2002:a17:902:8307:b029:ec:86a4:90fa with SMTP id bd7-20020a1709028307b02900ec86a490famr8867944plb.22.1619266483895; Sat, 24 Apr 2021 05:14:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619266483; cv=none; d=google.com; s=arc-20160816; b=zCzplywwxoYFO5wADilwJXQvvWgXhcT2O56Kr7ExJ3AppQqE3ptYNPFvgJO5FOYogL utXFEbWjAncjtqNOe8+G7iV+EA4rRpmKJpHY9BJJxdnLWD75Sx+fPDXM0SEKtqqYzqkW Rvst38b47z2f7nUqKnr8FxngmSejJjVeDFOSU9nNWDLteitjR7I/3MpzG0RrCYp83rfU cNZoYautGr/UnJTD0Qt+GR/QDiKtBy17ShXqr7LV5cE6DjjcMlEup+xJW6iAk6MwoUYt yPkSPFVTqaMVyzl/fXwpEHjGK0hmlcCLIbr+pVbG8pcHlNYREV1EAzTJbyny2BDkREFJ 3wHA== 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; bh=KlWqocxF4VTtfqI6kCPSrMWhJ2Iy9TbaPCexuOpMojM=; b=A2Jlv8kqdF1FgJAd1RkVjOg/dNYZbZ+O/wTYMunqkq+wdICst9G4grSOzQPLAkW5xV Zx9K6s5JhlPlhFd2oTbna4nDjg6b9tSnKnDJ/vi8/GFK9Tk7YoeGUgZfu29teFTjeZd6 TzQjRuXzfj6lVSyv3fv/RyvP+sMCSJYPk9iWySVsE0VMtYT3DJn48W38wC6yh+JW3Ug2 p7HMXIXRUwd0svmHu0szD6k/+26b89XL5g7LcO5dXSNSEs5uJZM3NKG+oFi0JJbqENPe oCtqHrI4aZA9Xd6SBN5huSkRZevB2oOQNgKks1vI8irHHF+LZJYN22415dMKBTvdqJpf K2RQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 83si9741761pfv.128.2021.04.24.05.14.29; Sat, 24 Apr 2021 05:14:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232867AbhDXMOY (ORCPT + 99 others); Sat, 24 Apr 2021 08:14:24 -0400 Received: from smtpout1.mo3004.mail-out.ovh.net ([79.137.123.219]:39635 "EHLO smtpout1.mo3004.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbhDXMOU (ORCPT ); Sat, 24 Apr 2021 08:14:20 -0400 Received: from pro2.mail.ovh.net (unknown [10.109.143.176]) by mo3004.mail-out.ovh.net (Postfix) with ESMTPS id 99D6723D114; Sat, 24 Apr 2021 12:13:39 +0000 (UTC) Received: from localhost (89.70.221.198) by DAG2EX1.emp2.local (172.16.2.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Sat, 24 Apr 2021 14:13:39 +0200 Date: Sat, 24 Apr 2021 14:09:36 +0200 From: Tomasz Duszynski To: Jonathan Cameron CC: Tomasz Duszynski , , , , Subject: Re: [PATCH v2] iio: core: fix ioctl handlers removal Message-ID: References: <20210423080244.2790-1-tomasz.duszynski@octakon.com> <20210424115250.14d21a71@jic23-huawei> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20210424115250.14d21a71@jic23-huawei> X-Originating-IP: [89.70.221.198] X-ClientProxiedBy: CAS2.emp2.local (172.16.1.2) To DAG2EX1.emp2.local (172.16.2.11) X-Ovh-Tracer-Id: 825003158838008914 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrvddugedgheduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpeffhffvuffkfhggtggujghisehttdortddttdejnecuhfhrohhmpefvohhmrghsiicuffhushiihihnshhkihcuoehtohhmrghsiidrughushiihihnshhkihesohgtthgrkhhonhdrtghomheqnecuggftrfgrthhtvghrnhepkeejgfevledtgfdtfeettdektedvieeiveduueetudekieetiedujedtleevleelnecukfhppedtrddtrddtrddtpdekledrjedtrddvvddurdduleeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhrohdvrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepthhomhgrshiirdguuhhsiiihnhhskhhisehotghtrghkohhnrdgtohhmpdhrtghpthhtoheprghruggvlhgvrghnrghlvgigsehgmhgrihhlrdgtohhm Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 24, 2021 at 11:52:50AM +0100, Jonathan Cameron wrote: > On Fri, 23 Apr 2021 10:02:44 +0200 > Tomasz Duszynski wrote: > > > Currently ioctl handlers are removed twice. For the first time during > > iio_device_unregister() then later on inside > > iio_device_unregister_eventset() and iio_buffers_free_sysfs_and_mask(). > > Double free leads to kernel panic. > > > > Fix this by not touching ioctl handlers list directly but rather > > letting code responsible for registration call the matching cleanup > > routine itself. > > > > Fixes: 8dedcc3eee3ac ("iio: core: centralize ioctl() calls to the main chardev") > > Signed-off-by: Tomasz Duszynski > > Acked-by: Alexandru Ardelean > > There are a bunch of unused local variables as a result of this change > (build warnings on my standard W=1 C=1 test). I've dropped those as well and > applied this to the fixes-togreg branch of iio.git. > Right, thanks for catching this. > We are a bit unfortunate on timing for this as I won't send a pull request > for fixes until towards the end of the merge window. I've marked it for stable > though so it should filter back fairly quickly so kernels people actually > use. > > Thanks, > > Jonathan > > > --- > > v2: > > * add fixes tag and ack > > > > drivers/iio/industrialio-core.c | 3 --- > > 1 file changed, 3 deletions(-) > > > > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > > index d92c58a94fe4..98944cfc7331 100644 > > --- a/drivers/iio/industrialio-core.c > > +++ b/drivers/iio/industrialio-core.c > > @@ -1939,9 +1939,6 @@ void iio_device_unregister(struct iio_dev *indio_dev) > > > > indio_dev->info = NULL; > > > > - list_for_each_entry_safe(h, t, &iio_dev_opaque->ioctl_handlers, entry) > > - list_del(&h->entry); > > - > > iio_device_wakeup_eventset(indio_dev); > > iio_buffer_wakeup_poll(indio_dev); > > > > -- > > 2.31.1 > > >