Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1941692ima; Thu, 25 Oct 2018 07:20:18 -0700 (PDT) X-Google-Smtp-Source: AJdET5fUhACjUiPv5mfiGdP7efLxlfDcb6bc8XkBfbFrgKaLYJFQ+7Hwi3OlG0WXwrpoLpbi7Kvb X-Received: by 2002:a17:902:8b8c:: with SMTP id ay12-v6mr1645258plb.69.1540477218343; Thu, 25 Oct 2018 07:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540477218; cv=none; d=google.com; s=arc-20160816; b=NRIciTO9klcwaRNE4O3ZBQVPRnZ7yVNX+xG/4HeqJOHPcVWx3SQGi/1+fw5NkAuqxT IJlFLxdN4klYL9cqn0uzvHOeoWqNY4kpUa5yap9/4863ZHaJJHmVkTXf/tKUCSoYwzcH RZd6BhgIJAimg/MaJIuvE+cn9WZAWjAylVIo7sR7WARVdpFK4SAzwIOonwk7TZ5+qwzB EGlGuNDG9p/CA41QYPr0N3SFGBe8VWcny/RULFOAOFY7PFv/5fP5nfu6hWB+ylnKi43Q IPGHzx1EpEMgddnIHaQ8yZasIIW4mhset2jMgkgqk6Y9/N7djkPs6OD5ZqEizX7grl/X IeSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=wRhUiotHfUeQPfJjVzmpE7Jx2mPxO+VLaYae2ReeU54=; b=A6iikJhIXho620GFV/gKh4bPHOROmUYfh49UpKs5T803p6GGikh1Mmr35TD0dgLS6p /GHF+I+CjtUk86DsLB/2MdL2urIWuaou11CsF6ULtw1EqAQ8yzdP1S+gx3l44cptuU4+ cu1/5EA7PJeBvYZMXVLVoTloZz8A/zA3taZAV4RwUva/uTZTlPSTPVJ7jB1VU5wvzLss XTwpDmVikBIWOJ7qcShEzIxTYKIW9IP08J0+vgRpk798hUwi4FxcCUkMDlHL65TCDZ8L 9vHbBvPE6yIFEXdgt/5dRoki7BRAMlZbzaGZFSL2d+AjwB94S2ukVX4XFqevElVGbupJ feEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bknw5XKq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si8008757plg.176.2018.10.25.07.19.34; Thu, 25 Oct 2018 07:20:18 -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=Bknw5XKq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730385AbeJYWwK (ORCPT + 99 others); Thu, 25 Oct 2018 18:52:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:34056 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727992AbeJYWwI (ORCPT ); Thu, 25 Oct 2018 18:52:08 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (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 64C1820868; Thu, 25 Oct 2018 14:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540477151; bh=G6J3ZOKCkA/A/NL5Kd33pMK396ZXIcXdJutYipJqa3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bknw5XKq8BT0NOHYScTAXYuM37T1++euGJKJ0pryTvpY9sFiUkEOyp/OdRlyhDtwy nX0sMvbTs8XTjkSG0wa2LvtPt5NoOxwSMlRHinAQ6tDWYNRrlSeAFZIP6hkRI4NYil fssAGQWI1WfZHLohT4SZBFG8l5i4uErg8ipLr0/k= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dan Carpenter , Felipe Balbi , Sasha Levin Subject: [PATCH AUTOSEL 3.18 09/98] usb: gadget: gadgetfs: fix an oops in ep_write() Date: Thu, 25 Oct 2018 10:17:24 -0400 Message-Id: <20181025141853.214051-9-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141853.214051-1-sashal@kernel.org> References: <20181025141853.214051-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 42d6cfa0caec4b68a7f17147fbf13a36e94a8bf2 ] We try to free an ERR_PTR on this error path. Fixes: b44be2462dbe ('usb: gadget: gadgetfs: Free memory allocated by memdup_user()') Signed-off-by: Dan Carpenter Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index e2d57e3d67c7..7974956e8ded 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -442,6 +442,7 @@ ep_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) kbuf = memdup_user(buf, len); if (IS_ERR(kbuf)) { value = PTR_ERR(kbuf); + kbuf = NULL; goto free1; } -- 2.17.1