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=-11.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 35F54C433DF for ; Fri, 29 May 2020 08:43:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 018812075A for ; Fri, 29 May 2020 08:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590741786; bh=2HujCkoDE49br79+rWGM1kcrzoWK+DG86BMuA16+EyQ=; h=Subject:To:From:Date:List-ID:From; b=UZz+YgrZFYHOrOUtey96nRWoWePawAaKFHa2x1oVOYL4GGLdI1NZYDDq77MY2LF3O xNjcg+eHwuKers2kOnP8zpp5vp5P79wKfvih8P0SgFLp3o59LgPdkdKYPebdlbx4DO OvU3Ojmkm/lvJtv+BUC1HwVw+PitEjwq6MxjwMVo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725562AbgE2InF (ORCPT ); Fri, 29 May 2020 04:43:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgE2InF (ORCPT ); Fri, 29 May 2020 04:43:05 -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 2B97F2072D; Fri, 29 May 2020 08:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590741784; bh=2HujCkoDE49br79+rWGM1kcrzoWK+DG86BMuA16+EyQ=; h=Subject:To:From:Date:From; b=iiYRG3XVk1zIApddq1j1KWa4SpKSf5CPk/doFxJXRl4zLqSqjlNu118mU0xVp2QgV 5TwoN74hR7XfSWnm0i0cTCVN8I1HChyFmZD87E7y5L4kgGY7F5QmgMU1B49XFi43J1 JrfnOP9XkTJCdlyxl3HeDfyvqxzfcEjD1NEDMKqY= Subject: patch "gnss: sirf: fix error return code in sirf_probe()" added to char-misc-testing To: weiyongjun1@huawei.com, hulkci@huawei.com, johan@kernel.org, stable@vger.kernel.org From: Date: Fri, 29 May 2020 10:43:01 +0200 Message-ID: <1590741781230217@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled gnss: sirf: fix error return code in sirf_probe() to my char-misc git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git in the char-misc-testing branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will be merged to the char-misc-next branch sometime soon, after it passes testing, and the merge window is open. If you have any questions about this process, please let me know. >From 43d7ce70ae43dd8523754b17f567417e0e75dbce Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Thu, 7 May 2020 09:42:52 +0000 Subject: gnss: sirf: fix error return code in sirf_probe() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. This avoids a use-after-free in case the driver is later unbound. Fixes: d2efbbd18b1e ("gnss: add driver for sirfstar-based receivers") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun [ johan: amend commit message; mention potential use-after-free ] Cc: stable # 4.19 Signed-off-by: Johan Hovold --- drivers/gnss/sirf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c index effed3a8d398..2ecb1d3e8eeb 100644 --- a/drivers/gnss/sirf.c +++ b/drivers/gnss/sirf.c @@ -439,14 +439,18 @@ static int sirf_probe(struct serdev_device *serdev) data->on_off = devm_gpiod_get_optional(dev, "sirf,onoff", GPIOD_OUT_LOW); - if (IS_ERR(data->on_off)) + if (IS_ERR(data->on_off)) { + ret = PTR_ERR(data->on_off); goto err_put_device; + } if (data->on_off) { data->wakeup = devm_gpiod_get_optional(dev, "sirf,wakeup", GPIOD_IN); - if (IS_ERR(data->wakeup)) + if (IS_ERR(data->wakeup)) { + ret = PTR_ERR(data->wakeup); goto err_put_device; + } ret = regulator_enable(data->vcc); if (ret) -- 2.26.2