Message ID | CAPgLHd8hQYqmP=F0MebGuVHHJG8XuSn0Sbe-dJEZoPAEnNV1rA@mail.gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1VOITl-00061g-Qe; Tue, 24 Sep 2013 04:35:57 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.72/mailfrontend-8) with esmtp id 1VOITi-0005Qr-mF; Tue, 24 Sep 2013 04:35:57 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837Ab3IXCfw (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 23 Sep 2013 22:35:52 -0400 Received: from mail-bk0-f45.google.com ([209.85.214.45]:44412 "EHLO mail-bk0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752503Ab3IXCfv (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 23 Sep 2013 22:35:51 -0400 Received: by mail-bk0-f45.google.com with SMTP id mx11so1497394bkb.32 for <linux-media@vger.kernel.org>; Mon, 23 Sep 2013 19:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=EC3scnEi9QCv2v/Wd337Wnw9uJIqk/TwLhBrV9YGqis=; b=s6/rwD/R1s5+MuZ3flZCfJVvclM1JPfN58k5O1L9riZDfewYbv0qzdmvY8b7OT2dA6 Afb1vr2JY2D5Za+8ASXk3TyRElTF0R0mdSeLNRvdKaDgCnxmLHaAnolRh/pch7eHcns0 vvUPzXtqVnH2UUdhpiighwt+W2eGucSscfJzAtO1McI7GxdaSH4oaxb9J4bmu25Jf6s9 kyC52W8i/nopnrji+Jetth2wgBaSVSapmW0lfQKIQWhIfPBGiwZcB6axQOLiQu4JkRg0 SS5k5S8ouowm1xKpQ1GJ1OnsL3hEzS5XH68V+L/3/3NYomPTOoQ+VB6BNBCW4EsXuA+f 17Mg== MIME-Version: 1.0 X-Received: by 10.204.69.12 with SMTP id x12mr20173779bki.12.1379990150787; Mon, 23 Sep 2013 19:35:50 -0700 (PDT) Received: by 10.205.13.74 with HTTP; Mon, 23 Sep 2013 19:35:50 -0700 (PDT) Date: Tue, 24 Sep 2013 10:35:50 +0800 Message-ID: <CAPgLHd8hQYqmP=F0MebGuVHHJG8XuSn0Sbe-dJEZoPAEnNV1rA@mail.gmail.com> Subject: [PATCH] [media] marvell-ccic: drop free_irq for devm_request_irq allocated irq From: Wei Yongjun <weiyj.lk@gmail.com> To: corbet@lwn.net, m.chehab@samsung.com Cc: yongjun_wei@trendmicro.com.cn, linux-media@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.9.24.22610 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' CN_TLD 0.1, FORGED_FROM_GMAIL 0.1, MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, WEBMAIL_SOURCE 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CT_TEXT_PLAIN 0, __DATE_TZ_HK 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_HTTP_RECEIVED 0, __PHISH_SPEAR_STRUCTURE_1 0, __PHISH_SPEAR_STRUCTURE_2 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' |
Commit Message
Wei Yongjun
Sept. 24, 2013, 2:35 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> irq allocated with devm_request_irq should not be freed using free_irq, because doing so causes a dangling pointer, and a subsequent double free. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> --- drivers/media/platform/marvell-ccic/mmp-driver.c | 1 - 1 file changed, 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Comments
On Tue, 24 Sep 2013 10:35:50 +0800 Wei Yongjun <weiyj.lk@gmail.com> wrote: > irq allocated with devm_request_irq should not be freed using > free_irq, because doing so causes a dangling pointer, and a > subsequent double free. Makes sense. Acked-by: Jonathan Corbet <corbet@lwn.net> jon -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Wei Yongjun, Thanks for finding the issue. It seems the last part code is missed when I submitted the patch. Please see the patch we submitted before in [REVIEW PATCH V4 07/12] [media] marvell-ccic: switch to resource managed allocation and request. The last part patch is missed: @@ -474,18 +461,10 @@ out_free: static int mmpcam_remove(struct mmp_camera *cam) { struct mcam_camera *mcam = &cam->mcam; - struct mmp_camera_platform_data *pdata; mmpcam_remove_device(cam); - free_irq(cam->irq, mcam); mccic_shutdown(mcam); mmpcam_power_down(mcam); - pdata = cam->pdev->dev.platform_data; - gpio_free(pdata->sensor_reset_gpio); - gpio_free(pdata->sensor_power_gpio); - iounmap(cam->power_regs); - iounmap(mcam->regs); - kfree(cam); return 0; } It seems there was some mistake when Albert transferring the submit patch task to me. And I did not notice the patch was wrong when submitting the patches. It is my fault. I'm sorry for the inconvenient Regards, Libin >-----Original Message----- >From: linux-media-owner@vger.kernel.org [mailto:linux-media-owner@vger.kernel.org] On >Behalf Of Jonathan Corbet >Sent: Wednesday, September 25, 2013 3:12 PM >To: Wei Yongjun >Cc: m.chehab@samsung.com; yongjun_wei@trendmicro.com.cn; linux- >media@vger.kernel.org; Libin Yang >Subject: Re: [PATCH] [media] marvell-ccic: drop free_irq for devm_request_irq allocated irq > >On Tue, 24 Sep 2013 10:35:50 +0800 >Wei Yongjun <weiyj.lk@gmail.com> wrote: > >> irq allocated with devm_request_irq should not be freed using >> free_irq, because doing so causes a dangling pointer, and a subsequent >> double free. > >Makes sense. > >Acked-by: Jonathan Corbet <corbet@lwn.net> > >jon >-- >To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message >to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo- >info.html -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c index b5a19af..3458fa0 100644 --- a/drivers/media/platform/marvell-ccic/mmp-driver.c +++ b/drivers/media/platform/marvell-ccic/mmp-driver.c @@ -481,7 +481,6 @@ static int mmpcam_remove(struct mmp_camera *cam) struct mmp_camera_platform_data *pdata; mmpcam_remove_device(cam); - free_irq(cam->irq, mcam); mccic_shutdown(mcam); mmpcam_power_down(mcam); pdata = cam->pdev->dev.platform_data;