From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752956AbbLNMdu (ORCPT ); Mon, 14 Dec 2015 07:33:50 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:49352 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752705AbbLNMds (ORCPT ); Mon, 14 Dec 2015 07:33:48 -0500 X-AuditID: cbfee6a1-f792f6d000001414-75-566eb72a8b35 Date: Mon, 14 Dec 2015 12:33:46 +0000 (GMT) From: Shivnandan Kumar Subject: Re: Re: [PATCH] char:misc minor is overflowing To: One Thousand Gnomes , Arnd Bergmann , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" Cc: Nitin Gupta , Vidushi Koul , Gaurav Kohli , Rajat Suri , Shailesh Pandey , "shiv.jnumca08@gmail.com" Reply-to: shivnandan.k@samsung.com MIME-version: 1.0 X-MTR: 20151214121151177@shivnandan.k Msgkey: 20151214121151177@shivnandan.k X-EPLocale: en_US.windows-1252 X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-MLAttribute: X-RootMTR: 20151214121151177@shivnandan.k X-ParentMTR: X-ArchiveUser: X-CPGSPASS: N X-ConfirmMail: N,general Content-type: text/plain; charset=windows-1252 MIME-version: 1.0 Message-id: <449107773.668471450096425280.JavaMail.weblogic@epmlwas05c> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsVy+t/tXl2t7XlhBpu7zSwu75rD5sDo8XmT XABjFJdNSmpOZllqkb5dAlfG8Wv/2QrOiFT8nXWKsYGxRaSLkZNDSEBd4tPatUwgtoSAicSZ 54fZIGwxiQv31gPZXEA1cxgl7vTcBkuwCKhKPNvaxA5iswkYSbyZtIIVxBYWMJeYNO0WM0iD iMB5RomLF1+ygjjMAhOYJH6s3c4OsU5J4sviuWDreAUEJU7OfMICsU5VYsmBvawQcTWJ00un MELE5SSWTL0MdR6vxIz2pyww8Wlf1zBD2NIS52dtYIQ5e/H3x1Bxfoljt3dA9QpITD1zEKiG A8jWkuibagkR5pNYs/AtC0z5rlPLmWFW3d8yF6pVQmJryxOw05gFFCWmdD9kh7ANJI4smsOK 7hVeAXeJvo77TBMYZWchSc1C0j4LSTuymgWMLKsYRVMLkguKk9IrDPWKE3OLS/PS9ZLzczcx gmP62cIdjF/OWx9iFOBgVOLhzViWGybEmlhWXJl7iFGCg1lJhLdnWV6YEG9KYmVValF+fFFp TmrxIUZpDhYlcd7b+/zChATSE0tSs1NTC1KLYLJMHJxSDYwGol56t6wmPXwrwn1Z8dyHWaGz dny/9S1+w3meIrNHpf7uKq189vcqb6k6T8maXn5Dtkr6YMsixRlBMfu+SS332f9dNjD4M6fK /tzipDNWk7ZGNah03F3C2HarLp0t5GbrRYu3jbIrtsRb10kceecYG+2ToDGpT/3Qh8ayoJ9T b61Ya+zS/1aJpTgj0VCLuag4EQDqWP2l5QIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id tBECXsc5025338 Hi Alan, Thanks for your reply. Patch is not intended to increase DYNAMIC_MINORS from 64. The error hadling in misc_register is not perfect. Ideally, when misc minor number limit exceed then it should return -EBUSY instead of already reserved minor number. For example, in my case value of "i" in function misc_register is 62, so misc_minor becomes 1. Which should not have happened, in this case it should return -EBUSY, as minor number 1 is reserved for PSMOUSE. In error handling condition, it should consider already reserved minor numbers also. This condition seems to be changed/modified. "if (i >= DYNAMIC_MINORS) { mutex_unlock(&misc_mtx); return -EBUSY; }" Thanks, Shivnandan ------- Original Message ------- Sender : One Thousand Gnomes Date : Dec 09, 2015 22:35 (GMT+09:00) Title : Re: [PATCH] char:misc minor is overflowing On Wed, 09 Dec 2015 12:51:33 +0000 (GMT) Nitin Gupta wrote: > Hi, > > Is there any modification / improvement needed in this patch ? > > ------- Original Message ------- > Sender : Shivnandan Kumar Engineer/SRI-Noida-Advance Solutions - System 1 R&D Group/Samsung Electronics > Date : Nov 20, 2015 15:35 (GMT+05:30) > Title : [PATCH] char:misc minor is overflowing > > When a driver register as a misc driver and > it tries to allocate minor number dynamically. > Then there is a chance of minor number overflow. > The problem is that 64(DYNAMIC_MINORS) is not enough If you are allocating more than the odd minor number you shouldn't be using misc devices in the first place but should be using cdev_init/cdev_add/register_chrdev_region and friends. So 64 really should never be "not enough". miscdevice is more historical than useful and really goes back to the days long before all the region allocators existed. Alan {.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I