]> git.notmuchmail.org Git - notmuch/blob - test/corpora/lkml/cur/1382298805.004665:2,
test: add 'lkml' corpus
[notmuch] / test / corpora / lkml / cur / 1382298805.004665:2,
1 From: =?ISO-8859-1?Q?Nicolas_de_Peslo=FCan?= 
2         <nicolas.2p.debian@gmail.com>
3 Subject: Re: [PATCH] core: dev: don't call BUG() on bad input
4 Date: Mon, 14 Feb 2011 13:16:04 +0100
5 Lines: 54
6 Message-ID: <4D591D04.4050000@gmail.com>
7 References: <1297680967-11893-1-git-send-email-segoon@openwall.com>
8 Mime-Version: 1.0
9 Content-Type: text/plain; charset=ISO-8859-1;
10         format=flowed
11 Content-Transfer-Encoding: QUOTED-PRINTABLE
12 Cc: linux-kernel@vger.kernel.org,
13         "David S. Miller" <davem@davemloft.net>,
14         Eric Dumazet <eric.dumazet@gmail.com>,
15         Tom Herbert <therbert@google.com>,
16         Changli Gao <xiaosuo@gmail.com>,
17         Jesse Gross <jesse@nicira.com>, netdev@vger.kernel.org
18 To: Vasiliy Kulikov <segoon@openwall.com>
19 X-From: netdev-owner@vger.kernel.org Mon Feb 14 13:16:23 2011
20 Return-path: <netdev-owner@vger.kernel.org>
21 Envelope-to: linux-netdev-2@lo.gmane.org
22 Received: from vger.kernel.org ([209.132.180.67])
23         by lo.gmane.org with esmtp (Exim 4.69)
24         (envelope-from <netdev-owner@vger.kernel.org>)
25         id 1PoxLn-0007s8-Rx
26         for linux-netdev-2@lo.gmane.org; Mon, 14 Feb 2011 13:16:20 +0100
27 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
28         id S1753819Ab1BNMQQ convert rfc822-to-quoted-printable (ORCPT
29         <rfc822;linux-netdev-2@m.gmane.org>); Mon, 14 Feb 2011 07:16:16 -0500
30 Received: from mail-bw0-f46.google.com ([209.85.214.46]:53692 "EHLO
31         mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
32         with ESMTP id S1753690Ab1BNMQO (ORCPT
33         <rfc822;netdev@vger.kernel.org>); Mon, 14 Feb 2011 07:16:14 -0500
34 Received: by bwz15 with SMTP id 15so5395788bwz.19
35         for <multiple recipients>; Mon, 14 Feb 2011 04:16:13 -0800 (PST)
36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
37         d=gmail.com; s=gamma;
38         h=domainkey-signature:message-id:date:from:user-agent:mime-version:to
39          :cc:subject:references:in-reply-to:content-type
40          :content-transfer-encoding;
41         bh=xx3YxuXgqhBANV8wzcWyUMECJelpRfdmoRSp1AKdYdc=;
42         b=N0KOUEiWNDJjbwFsNkzabK7eGUNcoUNkqBGVRMNJFQ1jIgKtMC9sXdcmSFkLf2G3W0
43          zzRsPc9T6wnstCSnGFjIStR1GQK4bQ7o7SC+bmV0UqsBQAMW8sdDkT20PMZlBl2X7PkF
44          a2TGrPtJKfEcGFXay9Xo1ZMu1aYODhlRfsZKo=
45 DomainKey-Signature: a=rsa-sha1; c=nofws;
46         d=gmail.com; s=gamma;
47         h=message-id:date:from:user-agent:mime-version:to:cc:subject
48          :references:in-reply-to:content-type:content-transfer-encoding;
49         b=vyCGwBn8dYUhOjmcV0am255nAUilQntfBxUI4yId3MocKlSBfEE0jJCJIVDySIAYOj
50          4g7FzXDeqZ5brwXgwA1derVfTXYvhKUC/60QA9/377l/PZ0vvRfqyPQcinMoOSCc+Kvv
51          vnBZtq/Kr+D4nUnefIwwjJ/dXS3dGjFBvis6w=
52 Received: by 10.204.98.65 with SMTP id p1mr25300616bkn.198.1297685772974;
53         Mon, 14 Feb 2011 04:16:12 -0800 (PST)
54 Received: from [192.168.0.101] (eab95-4-88-175-177-37.fbx.proxad.net [88.175.177.37])
55         by mx.google.com with ESMTPS id a17sm1733557bku.23.2011.02.14.04.16.07
56         (version=SSLv3 cipher=OTHER);
57         Mon, 14 Feb 2011 04:16:09 -0800 (PST)
58 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Icedove/3.0.11
59 In-Reply-To: <1297680967-11893-1-git-send-email-segoon@openwall.com>
60 Sender: netdev-owner@vger.kernel.org
61 Precedence: bulk
62 List-ID: <netdev.vger.kernel.org>
63 X-Mailing-List: netdev@vger.kernel.org
64 Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1099697>
65
66 Le 14/02/2011 11:56, Vasiliy Kulikov a =E9crit :
67 > alloc_netdev() may be called with too long name (more that IFNAMSIZ b=
68 ytes).
69 > Currently this leads to BUG().  Other insane inputs (bad txqs, rxqs) =
70 and
71 > even OOM don't lead to BUG().  Made alloc_netdev() return NULL, like =
72 on
73 > other errors.
74 >
75 > Signed-off-by: Vasiliy Kulikov<segoon@openwall.com>
76 > ---
77 >   Compile tested.
78 >
79 >   net/core/dev.c |    5 ++++-
80 >   1 files changed, 4 insertions(+), 1 deletions(-)
81 >
82 > diff --git a/net/core/dev.c b/net/core/dev.c
83 > index 6392ea0..12ef4b0 100644
84 > --- a/net/core/dev.c
85 > +++ b/net/core/dev.c
86 > @@ -5761,7 +5761,10 @@ struct net_device *alloc_netdev_mqs(int sizeof=
87 _priv, const char *name,
88 >       size_t alloc_size;
89 >       struct net_device *p;
90 >
91 > -     BUG_ON(strlen(name)>=3D sizeof(dev->name));
92 > +     if (strnlen(name, sizeof(dev->name))>=3D sizeof(dev->name)) {
93
94 "size_t strnlen(const char *s, size_t maxlen) : The strnlen() function =
95 returns strlen(s), if that is=20
96 less than maxlen, or maxlen if there is no '\0' character among the fir=
97 st maxlen characters pointed=20
98 to by s."
99
100 How can strnlen(name, sizeof(dev->name)) be greater than sizeof(dev->na=
101 me)?
102
103 Shouldn't it be "if (strnlen(name, sizeof(dev->name)) =3D=3D sizeof(dev=
104 ->name))" instead?
105
106          Nicolas.
107
108 > +             pr_err("alloc_netdev: Too long device name \n");
109 > +             return NULL;
110 > +     }
111 >
112 >       if (txqs<  1) {
113 >               pr_err("alloc_netdev: Unable to allocate device "
114
115 --
116 To unsubscribe from this list: send the line "unsubscribe netdev" in
117 the body of a message to majordomo@vger.kernel.org
118 More majordomo info at  http://vger.kernel.org/majordomo-info.html
119
120
121