Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1162866rdb; Fri, 22 Dec 2023 17:56:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEK1yrXH879wPMwD3kTZJUs3+woncECxOqO3N2lPu15H9mWzqzPjPl/TGV7taP5oqM+Cqh X-Received: by 2002:a50:aa9b:0:b0:553:a3ec:85fc with SMTP id q27-20020a50aa9b000000b00553a3ec85fcmr1383834edc.12.1703296584914; Fri, 22 Dec 2023 17:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703296584; cv=none; d=google.com; s=arc-20160816; b=A2TpQNsENup98F2RMxQyveHJCjKCFCeAEG9357UdrdkMbrLJ0JEEL5rvbksxXclM/e yKFZ5eacAq9hIzEXE/lc585/FrJ6i1rq2gZ7dGDB5X/IBtG90/rdpJyIFn0aSR/XzMR/ CDfE8moB2LEP5zx0oo9GO6Ah8ANmPZuUV9tm2Uode6TNsDpIDUdh1w9Od87J6RZgYkzT iJo9lD8hAK58kBZYNnperXxTrxjW+PcEDvlmRjJcuSW7RQft5ZN2FvAGSGYsNKYjoZ8W uyWRVYvH22A46aXEmaRCLakC5chL0lxDM6XfpdsvpjxP8IdwENQnkSS9XLK5UdqhHm+U d0QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7r3U79Qxj2jisK+rG3PDZznLSnbCkTYF/t8XERCjqLs=; fh=pC62+Xzu9rWxP3EwkFQHy3M37dHcdVo9RRC56IjE3s4=; b=cO5yx4wftb2NsSQwab51uNDo6DZn84Nc9Re1qlofn9PEa6tMydGshv0czUhhW6p649 aeYwQCZ6ca4jpBiGCRzWPrAfLDZ4RhhF7sDfprdbrgzlizsSInB7yt36L6dbvF2f0sqd YVEaXeUnAGSzMZ41QzoFIrGSgQO3yrcwO2qUW0eZ6TofdAidgPmj0rsGIJGvHLCT+Jm+ 6NQkjhnNDMtPITc9fPTyGFf/AoPrGuvahEaKH1Srj0R71lhGBSYxDGLj9itxpmDGtGQ5 ZstrEsiNPvk5g9heNvjwMcx+koqWt2JaLeoosrRkjQ7omGa3eyM7NAC3xxzQ1eKPY/cd Fl3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=RKse9g0w; spf=pass (google.com: domain of linux-kernel+bounces-10177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=semihalf.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id de2-20020a056402308200b0055484a9851esi267199edb.273.2023.12.22.17.56.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 17:56:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=RKse9g0w; spf=pass (google.com: domain of linux-kernel+bounces-10177-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10177-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=semihalf.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id AA2F91F23983 for ; Sat, 23 Dec 2023 01:56:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A88F2375F; Sat, 23 Dec 2023 01:52:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=semihalf.com header.i=@semihalf.com header.b="RKse9g0w" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 23127171BE for ; Sat, 23 Dec 2023 01:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=semihalf.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=semihalf.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-553a65b6ad4so2936001a12.0 for ; Fri, 22 Dec 2023 17:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1703296338; x=1703901138; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7r3U79Qxj2jisK+rG3PDZznLSnbCkTYF/t8XERCjqLs=; b=RKse9g0wJNNVq91nhwm1yVh1KYuDT1YK3N+kVUb4H3W3bn/t0BnV96S3VnRJfIg6VF lHB0wo44x251GEGjw47cLot0theLXMgTcO2ZBd3VNSWkoTBMgPoAwod7S2EjMMWM8hjB 5rz2IGufiwtM8sAPzMEUxD2SRMAU95VjquvkR2m4pWJl6f6095fIAk2I024LFbogN6NY x9qS235MRvY5YFwYmrC3+dMzUxrl4qvqcY6tswdV0Xr1e8QdBCCTIMr5hOthQEzEYkkF U6ph7IzHw2ZHXIdb1qMamKyDem/eHXbj2LoHGE3cFlreRdZg/3OAgYIV6Eln5DIxyk1t 4MiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703296338; x=1703901138; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7r3U79Qxj2jisK+rG3PDZznLSnbCkTYF/t8XERCjqLs=; b=CVD3gflz/GaD6WLPnn7+rlIYN982bXn4A9RxZt04wI7F7t4PcOQn4tDWld4rQOhI4C cnlw23NyUkY5/RwQUjYIk6Rm1IWwlip963zmGNb+C/c+VGrSshhqaJTf7v00nhjgzptD /6g9kgY4gkgF2xCR74XUR7A9YHv84uG7yLG7gjqDcwX1f/bHS9WCC35WmiGTLvfloQzf ltShxJxEbGvzbScDVAX+LsVZSOqMBH59D8+cIFE+K4A9bmoBPi2aBrXYlofFgtp0Q0/5 AuWv2VdoWpzQgtONXEjTWuZFLCd221Mnxa+WlPY1prt03Xoze1VdRHLWzc3twiGcKxFZ QTZA== X-Gm-Message-State: AOJu0YxgpBN1qKftH3EVycJ9ZS5YeFkJzk9bqiZAj34PsXBpJDKTcAk+ LiGbOeu3rhdgrBbPLK2dxihi5gIu+4Gc X-Received: by 2002:a50:9f0f:0:b0:553:ee28:b97d with SMTP id b15-20020a509f0f000000b00553ee28b97dmr1537599edf.39.1703296338568; Fri, 22 Dec 2023 17:52:18 -0800 (PST) Received: from ukaszb-l.semihalf.net (alfa56.extreme-net.one.pl. [213.77.89.56]) by smtp.gmail.com with ESMTPSA id h2-20020a0564020e8200b005532a337d51sm3288494eda.44.2023.12.22.17.52.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 17:52:18 -0800 (PST) From: =?UTF-8?q?=C5=81ukasz=20Bartosik?= To: Jason Baron , Jim Cromie , Andrew Morton , Kees Cook , Douglas Anderson Cc: Guenter Roeck , Yaniv Tzoreff , Benson Leung , Steven Rostedt , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , Simon Ser , John Ogness , Petr Mladek , Sergey Senozhatsky , linux-kernel@vger.kernel.org, upstream@semihalf.com Subject: [PATCH v3 17/22] dyndbg: fix old BUG_ON in >control parser Date: Sat, 23 Dec 2023 02:51:26 +0100 Message-ID: <20231223015131.2836090-18-lb@semihalf.com> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog In-Reply-To: <20231223015131.2836090-1-lb@semihalf.com> References: <20231223015131.2836090-1-lb@semihalf.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jim Cromie Fix a BUG_ON from 2009. I have hit it while fuzzing >control on some other patches, and panic from user input is bad. Replace the BUG_ON with pr_error and return -EINVAL. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8ce485fc84ff..d4e50e4f6635 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -650,7 +650,11 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) } else { for (end = buf; *end && !isspace(*end); end++) ; - BUG_ON(end == buf); + if (end == buf) { + pr_err("parse err after word:%d=%s\n", nwords, + nwords ? words[nwords - 1] : ""); + return -EINVAL; + } } /* `buf' is start of word, `end' is one past its end */ -- 2.43.0.472.g3155946c3a-goog