Re: [PATCH RFC] serio HIL MLC: don't deref null, don't leak and return proper error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 20, 2010 at 10:13:45PM +0100, Helge Deller wrote:
> On 11/09/2010 07:35 AM, Dmitry Torokhov wrote:
> >On Sun, Nov 07, 2010 at 08:36:33PM +0100, Jesper Juhl wrote:
> >>Hi,
> >>
> >>While reviewing various users of kernel memory allocation functions I came
> >>across drivers/input/serio/hil_mlc.c::hil_mlc_register() and noticed that
> >>  - it calls kzalloc() buf fails to check for a NULL return before use.
> >>  - it makes several allocations and if one fails it doesn't free the
> >>    previous ones.
> >>  - It doesn't return -ENOMEM in the failed memory allocation case (it just
> >>    crashes).
> >>This patch corrects all of the above and also reworks the only caller of
> >>this function that I could find
> >>(drivers/input/serio/hp_sdc_mlc.c::hp_sdc_mlc_out()) so that it now checks
> >>the return value of hil_mlc_register() and properly propagate it on
> >>failure and I also restructured the code to remove some labels and goto's
> >>to make it, IMHO nicer to read.
> >>
> >>I have no hardware to test, so please review carefully and let me know if
> >>I've done something completely stupid. Please don't merge this RFC patch
> >>unless at least one or more people who know this code and can actually
> >>test it have ACK'ed it.
> >I think Helge Deller (CCed) used to have access to such hardware...
> 
> Yes, and I tested the patch successfully.
> 
> Tested-by: Helge Deller <deller@xxxxxx>
> Acked-by: Helge Deller <deller@xxxxxx>
> 

Applied, thank you guys.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux