Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3360753pxb; Mon, 24 Jan 2022 08:03:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhKYjVV8UapLzm4tC1kA+6TbcrOigRpkzuSKdzNw1f6OdC2ALmf5+B9xDCkAq2oQ2m9Okl X-Received: by 2002:a17:902:704a:b0:14a:b62b:f41b with SMTP id h10-20020a170902704a00b0014ab62bf41bmr14896313plt.93.1643040198457; Mon, 24 Jan 2022 08:03:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643040198; cv=none; d=google.com; s=arc-20160816; b=RklV5Gs7tgOzOMqyYyfq4OLeMl1spWbQadviNOqDgPSGRcym+MZwO2tQK0e5HKFr3y VjaXXKLG8IBaAl1cJgiqZXfV2zJC1GxyhIw8jB7cMQC1uKFeJWSZQ7A1EHBcBEQ6fWjF grmP/1Yp9XDto1CwAY74pRfuL42lwQ8+/q8wtv59rsTtv17dN0fgyoO9bVbeEdhp/Zte o/w6tkrjESqCYd1ZSYr2F5CCEeGt69bBzngC/wybUhTALgS+WuVu78W2NIJ40A126TFz BNH22BYfwLFMCCLy3sYjzyaJMtggto5OEOxGHzdttxjasyXZdrlAt/NivAXwo9/B6SOP KlGA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=RX6Av1jIiyqXvZYjcpZEeGLsyORkpiw+PH/GcVKGsHk=; b=aNL0x86H+f2sJkltYWPzpSW4Dhom7mKg8mIy0w/l01kFD2BFkXS4WgEPQ+PUqrmBW+ b82ayfo4C9FvnBCW1UQaXcqXcYYs2x6VGpptddfbGSNNWABtX3zeUL4bAxXrmDZHjNYH 1zGnCpOuuvKspP9wpIWUf6e9m0jAa1GxmEPt5h20W6odFaaN4dmtOsHiM27VIV3ime6+ eMkkzSGuw3Nc8r23QkF+4/Gormd64OYqK7OaTniDDaGbh2b3HasJLLZTXBVac9UBkYsn KjZvHfcXxEp7ELUMVkVHPVMcQVvq7U4JI9Swhp9ouqcpGsfeA6tpQeeD58mjhW1gmoaL pqCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TVighjXm; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si15379573pgu.689.2022.01.24.08.03.05; Mon, 24 Jan 2022 08:03:18 -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=@gmail.com header.s=20210112 header.b=TVighjXm; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241056AbiAXDae (ORCPT + 99 others); Sun, 23 Jan 2022 22:30:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241038AbiAXDad (ORCPT ); Sun, 23 Jan 2022 22:30:33 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F025C06173B; Sun, 23 Jan 2022 19:30:32 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id d5so12651565pjk.5; Sun, 23 Jan 2022 19:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RX6Av1jIiyqXvZYjcpZEeGLsyORkpiw+PH/GcVKGsHk=; b=TVighjXmld8xjrLsacTJCmUi8xhvnHU+SU2zVkR93VRMOoaA5A+oScrkxaodwFq50j 78/84wVestiPhMtV2WWr3chJ1UgTcgLk21X1vCXpcT9tjr6Isqd3Aq88uLTDu4l6QeTO p2FqyiqbFX6Vqh88Hxkswi+eXed7BvZ5NmtHAMAXow3ydduW6bWMnZBn6EExFHWi9tpK CQpBl3KoSRE93i6HsJw1reE+KifNt06FM+UG0NVK6AXRBikPLAJt6SQSMExulX9fcCVv cHvmrh8L3NxdjvkxG7HfsSoA81UzF1MR9ckRBb27O8nll8mJvC2UkOUIDXYYA+mNcIQe 16EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RX6Av1jIiyqXvZYjcpZEeGLsyORkpiw+PH/GcVKGsHk=; b=MUzGXrhvvj6i1YKDjDZYkqWeB5hKrqGfyEBN2QpZiaWWbu7Q3oNLzUmGMKGQkhUkAM /Ho18jAuwfkW74TOjYzFnOM9fZdu71sMzR4+VCv2oZJWYXI9bc56/qIP41m/FqqJ+6VV Xa19xsIMSs5GY9j97XzrhVyeKENxjU0qHHNEJOqc0ew+xu6BWNDlYqSimQ5YY5CWSGqs fmegjVUC964dljPxPv0k87gHmJIHInnYAKhY38hcESqzkQGQvqv6zD3CaMb6C+dfpmmw fOhyFsFmSsyvw7RnT0MtS6D0wxDZvUA2Ng4OzejpaV7W4FTQsEcw+9C34qmVcXrCEnU/ wpWQ== X-Gm-Message-State: AOAM533pkZiBnIUkSoMKNweN9aB6ferfAllNMv+Eql8BjvnYPWHyQrGB tXfPz8rRmeIZBKS+DQFNXIc= X-Received: by 2002:a17:90b:3a85:: with SMTP id om5mr56077pjb.150.1642995032168; Sun, 23 Jan 2022 19:30:32 -0800 (PST) Received: from slim.das-security.cn ([103.84.139.53]) by smtp.gmail.com with ESMTPSA id g5sm11178639pjj.36.2022.01.23.19.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 19:30:31 -0800 (PST) From: Hangyu Hua To: jpr@f6fbb.org, davem@davemloft.net, kuba@kernel.org, wang6495@umn.edu Cc: linux-hams@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hangyu Hua Subject: [PATCH] yam: fix a memory leak in yam_siocdevprivate() Date: Mon, 24 Jan 2022 11:29:54 +0800 Message-Id: <20220124032954.18283-1-hbh25y@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ym needs to be free when ym->cmd != SIOCYAMSMCS. Fixes: 0781168e23a2 ("yam: fix a missing-check bug") Signed-off-by: Hangyu Hua --- 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 6376b8485976..980f2be32f05 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c @@ -950,9 +950,7 @@ static int yam_siocdevprivate(struct net_device *dev, struct ifreq *ifr, void __ ym = memdup_user(data, 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.25.1