Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299090

Re: [PATCH] cx231xx: correctly handling failed allocation

Path csiph.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Devin Heitmueller <dheitmueller@kernellabs.com>
Newsgroups linux.kernel
Subject Re: [PATCH] cx231xx: correctly handling failed allocation
Date Tue, 29 Dec 2015 20:10:02 +0100
Message-ID <qL7OG-4A4-9@gated-at.bofh.it> (permalink)
References <qL7EZ-4gU-3@gated-at.bofh.it>
X-Original-To Insu Yun <wuninsu@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernellabs-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yB49emu8ku1uKCjGj21iT4+1iwMFHwh8DpWhWJ+TIZs=; b=cpbwUeEaX6hdXna5MsFDLgdBgZ2dFov/601fHWRydjRfe8D5JTmEXSIKry/Vs2vEcS Z+k3iidf8Y9MQ6pkuEshpZTi2tydXfiQPE4v+E1iMrKiZMLligeNnlRD8IH34rAP9Ojh XtQXhpOIQJdfSIOEl0oEBBsE/f3N6eEKyTBet26vMApAYZUoDjyNtiWMbImhH6nCZSne cbwlFyeOlB+WqqlLpMrfethwR5IzLPqUoEE8bon5rV8vcIuOljwgml3LMOuoEbshVStB IfW//QwlxW03612c18beNgX/Fx+p3m7bfITKX0mcK688Px/BfuMSGTJ9C5/TArxO8ZGg XjRg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=yB49emu8ku1uKCjGj21iT4+1iwMFHwh8DpWhWJ+TIZs=; b=UFGHMPxwDQ9q0GjRoykjwBPQdIcGYj2ISNLOG8OSWz95tn6W9a/QMdokokW0ieYCmY 5Wf+LYvpzB3r4FgC6skLqO6jrSILBKQlDr5Py4846svnTw5hAPB19SKAaOO2TXzk4r/+ m0rLKSCyeVRYCT9SQUlNIQOa/V06BuOjBRtaNRM6u6md+CzL1fM1mak8LwQ6pfi+lqWW k4xi5/3PPGxJCCb10bzGKxM5oxWinD+xm1XC7OSNG8W/l5G/5oqPPTWB98VJNZy2TSYy GHf7Zh+wJaYL87ohg/e4XqZI5Cw3v7pJcrV+ouWCVnYssrdCGhE/GDSpcHVqbD7QKMP3 K6dg==
X-Gm-Message-State ALoCoQnjpf/n+txYlorRjy9RfyPF9nSJTiqsmD+hBP0M/4LlnfIvv99GxLXSdDsGo/8T1xViWCBap7Fbwbk7+vH+L1U575QqS2ZQXZlYsqkqaoh6d0mB1ps=
MIME-Version 1.0
X-Received by 10.129.101.198 with SMTP id z189mr8064011ywb.275.1451415940150; Tue, 29 Dec 2015 11:05:40 -0800 (PST)
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 39
Organization linux.* mail to news gateway
X-Original-Cc Mauro Carvalho Chehab <mchehab@osg.samsung.com>, Hans Verkuil <hans.verkuil@cisco.com>, Prabhakar Lad <prabhakar.csengg@gmail.com>, scott.jiang.linux@gmail.com, Linux Media Mailing List <linux-media@vger.kernel.org>, Linux Kernel <linux-kernel@vger.kernel.org>, taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu, changwoo@gatech.edu
X-Original-Date Tue, 29 Dec 2015 14:05:40 -0500
X-Original-Message-ID <CAGoCfizkR_1hiayvfM2UVQYGpVGfMBJp5tveghRpphejSH+4gg@mail.gmail.com>
X-Original-References <1451415215-8854-1-git-send-email-wuninsu@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1299090

Show key headers only | View raw


On Tue, Dec 29, 2015 at 1:53 PM, Insu Yun <wuninsu@gmail.com> wrote:
> Since kmalloc can be failed in memory pressure,
> if not properly handled, NULL dereference can be happend
>
> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
>  drivers/media/usb/cx231xx/cx231xx-417.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
> index 47a98a2..9725e4f 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-417.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-417.c
> @@ -1382,6 +1382,8 @@ static int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb)
>         buffer_size = urb->actual_length;
>
>         buffer = kmalloc(buffer_size, GFP_ATOMIC);
> +       if (!buffer)
> +               return -ENOMEM;

A kmalloc() call inside a bulk handler running in softirq context?
That doesn't look right.

That said, I don't have any specific objection to the patch (which I'm
assuming came from some automated tool), but I suspect the cx231xx-417
code is probably completely broken.  The only device I've ever seen
that has the cx23102 and cx23417 is one of the Polaris EVKs, which
AFAIK nobody has ever shipped a production design based on.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] cx231xx: correctly handling failed allocation Insu Yun <wuninsu@gmail.com> - 2015-12-29 20:00 +0100
  Re: [PATCH] cx231xx: correctly handling failed allocation Devin Heitmueller <dheitmueller@kernellabs.com> - 2015-12-29 20:10 +0100

csiph-web