Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3285242ybb; Tue, 31 Mar 2020 02:06:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtb1UnR20RJ7yo3Dtjn1eiGnxytcGOIm784xooSynFzQNy1P37tpAqx8WHi2P4k2Aofx3bd X-Received: by 2002:a05:6830:1e19:: with SMTP id s25mr2469179otr.86.1585645562489; Tue, 31 Mar 2020 02:06:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645562; cv=none; d=google.com; s=arc-20160816; b=L2MfAY7CAui/MY9kGjhMC3Lf+EdzFE2DuGb0SDXyqWErKSvGwqYofpJR5EZhqx54Vl ib249HkyNNJDw9u7cEbJBpvidfgRKDIBgxzyi3L2KO7gDokjhEo1ZzD3S+7gbN6cUIFk wPXwU9HK1TSyraZcWYuCw4OIyPI+LESNzo55oDo3BOEJc7DiLBExWef6jPIHnDDy67tY HeoZivTtogJb0rX+H4V08UJnIifp842IktvM6zQm5E/+H236LLrWdHaRbiW067hoKTr0 ZfBX10r4EzSFOUa0q4ieTmulP+qp4ph3zTrZKlDCLOSd1BRw4E5jTWtA/5ZfbHDynBKV fxKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OgpaQqvZsUL4KUBjnr/prbG5z0jhyDzTDO4anOTYCMA=; b=sGQeNwNbMdXOrHwi5fadN6PCswobGnlOU+ToDDztS/GeS3ToIHmIoyCMcsQNgA6sSI 3oEqoyn8A5x/VfPZMdzE/6WOJ4OiFwh8iV5bGE1bpHlL6QjxaoIM2NicQyJPBR3hJA5W AkfzJyiWukLTXDsgd3Sqr51GQyfwVrSzO84CY22XLpfSbzJKlnSx2y3i0lIDE4+brkJi w8XQXgvRMPS1ADpiCYpFU3cedgBaFJbmvLytYKnp8L8t9CxbkE3TLFwnJmnls9jRUH94 CyGnIK9ZJMBx8tF5elo1Ft+76CEEokyp2atFrjiKyBESfRYPS9+14qigQIGzGm7x7drw Lo6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l3jwnaK1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si3192921otq.134.2020.03.31.02.05.50; Tue, 31 Mar 2020 02:06:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l3jwnaK1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730798AbgCaJFX (ORCPT + 99 others); Tue, 31 Mar 2020 05:05:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:46196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730470AbgCaJFT (ORCPT ); Tue, 31 Mar 2020 05:05:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DC46F20787; Tue, 31 Mar 2020 09:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645518; bh=AlHW95CssIqsx8U4u/AbjdIfdvzK5ovjHTD8W6WJLuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l3jwnaK1dSiu2dY5JvnJP4ptG0sAr5YqdoHH7ZUKQkrM+w3nuEYB9+UGjOup5SCIO bgIs6SRLoR74qACuTVckfO5TN0fa+17i9GxJXWUrGFeI8ZyXo2AkaAyR5U52eZU7Zn xuH6mzo1EssMcncDStK1Wl82oxwbeRPeojxLjTUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominik Czarnota , "David S. Miller" , Sasha Levin Subject: [PATCH 5.5 078/170] sxgbe: Fix off by one in samsung driver strncpy size arg Date: Tue, 31 Mar 2020 10:58:12 +0200 Message-Id: <20200331085432.618157886@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 52ed111d98f4d..15e3f668218b1 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2279,7 +2279,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