Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp866466pxb; Tue, 1 Feb 2022 12:03:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwWqCYmoOVfSnu/KDotXxMZ8IZuc1AJIIU5sMh7C+Ix2nwXRgX/WeyKC9XJC3izmPKzBLv1 X-Received: by 2002:a17:90a:d144:: with SMTP id t4mr4176428pjw.18.1643745830914; Tue, 01 Feb 2022 12:03:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745830; cv=none; d=google.com; s=arc-20160816; b=MZEtXhDTLJF9yrYQfi2UXUEtWR78uGC/M16zGI9EXSFsOtqIGD0qBciIFOur3IUDqa k27bof8MlHGZ2rSpTg1PheUdVQvDxaRKDYh182RFxhd8bWHAQYLSUzsyc7w8GyC3AIXw t3zfOhQcMFW8u3/m5JRjDiw4NT18X/1J4EV+iJhqNNCbXCRMtkts2+RHf2eYKMEFR85A NBfa047OmeuOVW5s9dJfX1XLKsMkct6PxUNTcnfXD030CEggqSmUyQqk1orA+7T7BobV hD7qxAZ2CQDVAaegcm9EwyS4TpMMHyuOmuCn6rEO0UW4P+xbMLCZzJbLwAi/07IN/HlK ZNvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/sBvcw9mHrRVriQ6UHIISeU3xn0XCt5psdSejE4lMPI=; b=VjAlqvi2WSRmrbF33jCmisYB1lmGRxcf4DpTmg6n8Cip6xtPtkfrapOiDTgaaGvmya XcWFqzOKkX7dJzFV4ZvdzCQPaOQoT848B5rerZYK/i8rMkgn0P9P3c1hhIDWm2xk2KS+ E8VTXazGjL1gAozLeXteM0biZgRxqgHRLyviu4aQNubA3x6jh0RiakcYMWm9WzjmUXAl FjQ9w3yX+yngh2QI6DPZ4KUyE5TBfzEI2j3aXn6j3UIotfWc3yEWCwu5F/eQ5xAeSVyc 3gJpInrKD5p4CFskl4cc+chtddjWBvMR3OFiEsJQlRbUORoSPADHp/mC6YY7Qn6Lyosx ch0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p76fQLri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 207si18059413pga.681.2022.02.01.12.03.34; Tue, 01 Feb 2022 12:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=p76fQLri; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359134AbiAaLQm (ORCPT + 99 others); Mon, 31 Jan 2022 06:16:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376861AbiAaLJN (ORCPT ); Mon, 31 Jan 2022 06:09:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A89D9C06176C; Mon, 31 Jan 2022 03:05:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46DB960FD3; Mon, 31 Jan 2022 11:05:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BE44C340E8; Mon, 31 Jan 2022 11:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627144; bh=GZs9L7T9/6ZSXdD31buqSGJavwQTf+8MmVZed58b7SQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p76fQLriKmSUuTPzcKBuxW2DNmq1Yi592q4rAeznuPJXRSjSaW3oaHH6ELuCytZwq LHxnjKG0ywQSk96zQZAWZTQqq3xZ9QVsI5csvk7ffkTHd/0ZqBj5iIuo3k6ZsA7LaM sDaI3LOfYVZdtV7BKV1wSaZPyBOchxZDlhaW/fTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 088/100] yam: fix a memory leak in yam_siocdevprivate() Date: Mon, 31 Jan 2022 11:56:49 +0100 Message-Id: <20220131105223.422990110@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hangyu Hua [ Upstream commit 29eb31542787e1019208a2e1047bb7c76c069536 ] ym needs to be free when ym->cmd != SIOCYAMSMCS. Fixes: 0781168e23a2 ("yam: fix a missing-check bug") Signed-off-by: Hangyu Hua Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/hamradio/yam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 5ab53e9942f30..5d30b3e1806ab 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c @@ -951,9 +951,7 @@ static int yam_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) sizeof(struct yamdrv_ioctl_mcs)); if (IS_ERR(ym)) return PTR_ERR(ym); - if (ym->cmd != SIOCYAMSMCS) - return -EINVAL; - if (ym->bitrate > YAM_MAXBITRATE) { + if (ym->cmd != SIOCYAMSMCS || ym->bitrate > YAM_MAXBITRATE) { kfree(ym); return -EINVAL; } -- 2.34.1