From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E90A8C4332B for ; Wed, 18 Mar 2020 20:59:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B64FA208E4 for ; Wed, 18 Mar 2020 20:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584565189; bh=BDs+C/coW+DnubOt+dhIDCaG5Up4p/pEmCVLYl8TFMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uoefZ/2xjYglDlMWbeVT6bHn4fv2QHJBIesluWcbIFEMHbUwDMFx4YGNJaBq/4Ps+ dPfDygf1kd6a1jXGNGHgtw74cLtG0Deatdip110xI9H7XF1m2YLxdLaVqqhgFOhk9A Yg9dtWub7Wz29LB2oGxr6h2d+07vf3XGb+nlabVA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728842AbgCRU7s (ORCPT ); Wed, 18 Mar 2020 16:59:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:58014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728196AbgCRU4p (ORCPT ); Wed, 18 Mar 2020 16:56:45 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 81159216FD; Wed, 18 Mar 2020 20:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584565005; bh=BDs+C/coW+DnubOt+dhIDCaG5Up4p/pEmCVLYl8TFMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZI2L9dl8Lz418tp0woD2ZozxpbSxVQ90Aht3DNbwf3ZMU+j/t44iE06i5tMqsZLI 7F5icDN2mdPY8bUpgY58eoFGtzBHg3lhLlr/VcsilmNxWS2VEUnInjSkFtsl9l8G+t aansPmWVdQMUJDCjxwiRIYE3tjoa2/Osn15pR2Q4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dominik Czarnota , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 13/15] sxgbe: Fix off by one in samsung driver strncpy size arg Date: Wed, 18 Mar 2020 16:56:27 -0400 Message-Id: <20200318205629.17750-13-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200318205629.17750-1-sashal@kernel.org> References: <20200318205629.17750-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dominik Czarnota [ Upstream commit f3cc008bf6d59b8d93b4190e01d3e557b0040e15 ] This patch fixes an off-by-one error in strncpy size argument in drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c. The issue is that in: strncmp(opt, "eee_timer:", 6) the passed string literal: "eee_timer:" has 10 bytes (without the NULL byte) and the passed size argument is 6. As a result, the logic will also accept other, malformed strings, e.g. "eee_tiXXX:". This bug doesn't seem to have any security impact since its present in module's cmdline parsing code. Signed-off-by: Dominik Czarnota Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index ea44a2456ce16..11dd7c8d576d6 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2313,7 +2313,7 @@ static int __init sxgbe_cmdline_opt(char *str) if (!str || !*str) return -EINVAL; while ((opt = strsep(&str, ",")) != NULL) { - if (!strncmp(opt, "eee_timer:", 6)) { + if (!strncmp(opt, "eee_timer:", 10)) { if (kstrtoint(opt + 10, 0, &eee_timer)) goto err; } -- 2.20.1