From patchwork Thu Jul 12 21:52:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 141838 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp69113ljj; Thu, 12 Jul 2018 14:53:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdj+daWTSJ3oKQojLcBRn8bfObX92+EQw24hkQDG/y1ppa+g0yYzVKU5JrVwZu13CDZAU9c X-Received: by 2002:a50:a2a6:: with SMTP id 35-v6mr4271435edm.276.1531432382287; Thu, 12 Jul 2018 14:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531432382; cv=none; d=google.com; s=arc-20160816; b=n1Tn7qy2OFnn1SqhT0jAC0gY0tDIqhIuZ9RJoMyh+EUCmI0+vCaEuVfDhG4cc6Gtsa ibyhA4mXPsE3lPf3D5XuPhDr1fAF5WAGcInhkfv9cOUGfliAlWYEb7rLwUF/MSQsVF1q yFNFiKKJdp21PTALUUoMeF2htd8QmACvueJdRW8ITMlXBjvp2i6L6I8Rh0d5v60Xr+ij bAtcoZIeYb/1fRmRAO8bbDSXsi9X4ccXc4Ckw2iYE+AGzgwd4alemijLMw9hyP2cqgUZ axtCFqjPsEWK9omgQmBLiGoPj+5aWKd8DbTO78juuA8o3TNvX44FyRcL4L9CJqf6FfBe /jlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=Hwnt56RQppDGrQ6xYnbjhuaqUQpAKBKrhlvJy+ZZgKE=; b=vr80A80iwlcGRPsAx+M7ADUXwqEF/QDR34zCpJb6Q2XhJRwof+Pmim40gMxNhS3SkV hpT1V9Hk9hCL9jaoLWunwAreAQ2K06kpni5tgxqc8VwLRttjnWJU7JcB/JvNiVvxbdSs u9FEyM2Du2YxwKc6kQ/XENKX1g6aVCkn66txnuFUSzST723fmEHJCgH23aEH80JHpphK wzAWhf1JS5i9z4LWl2QjF92Q5FbYRHFU+ZKpv3KXFlX2W0AQnyixYofkl7Hwky6nmDft 7qUqkM8/yoqGVxt6Gwfvxl6EGkLn+oRyHyb3XuTwt9a5vErvu1UVyBJalrVbGJsuTePg SQAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fK40JjGu; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id r52-v6si337770edd.119.2018.07.12.14.53.02; Thu, 12 Jul 2018 14:53:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fK40JjGu; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id D26D3C21F9A; Thu, 12 Jul 2018 21:52:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 8BA80C21DA2; Thu, 12 Jul 2018 21:52:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 743F0C21D56; Thu, 12 Jul 2018 21:52:56 +0000 (UTC) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by lists.denx.de (Postfix) with ESMTPS id 19353C21C57 for ; Thu, 12 Jul 2018 21:52:56 +0000 (UTC) Received: by mail-lf0-f68.google.com with SMTP id y200-v6so25488326lfd.7 for ; Thu, 12 Jul 2018 14:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=Ci2F9n5YN2dcoacFO0xdMAzqHklUx8GCdYfpO1fbmg8=; b=fK40JjGu2I2mmrp3qTVw0xH/tR0RIjBv1tW5mNgq+ZJmH2tcLnbHeGNJXNdVed34qf JLId8V0FBoSfLHUnkG7scYOhqknjyhn1MNOGa2Jj/iZpJcoIvhSlsCwywZr/0JGCUceb RXSV+aIGAzrTU980sju2347jfFnrXYn0KUbNs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ci2F9n5YN2dcoacFO0xdMAzqHklUx8GCdYfpO1fbmg8=; b=VhRZPPvr5f8SZhvIkdusJuNGmehzQa+LqmXVi3HmAt7pmObiF2VKslc3CpeFx/RVnZ H3XIt1F7kmqF03apk+hV049/MVTRkoZwBzxVVD5Mj0oyJd1sLBxPxCnpPgpZxVja7bZm J0SCV6g+l+djdQo6vbatERXXXdn/TbCbjQEFCGPVbntzFz6rSDyp0v4/rH/TvquP8k8s jVCjR6j/lOzvZTahJZHjHdtaYC4MBblbznXb9RbdPMQbMoIOYVHou0y0aTGF3rTu6bQI Y2gBwNNx2c6xf1gw4KMFtNNYuoksnB/Nzv3sYZyZrEKNqNLEWUm1XEHzAr1bLWmILeqM lqaA== X-Gm-Message-State: AOUpUlHZZ/TYLVwp533MF/L2r6TticsdHWdbfF7x28nmODPz/pGP4qUz 5tASeNWJw/yElHeMBsy3zEb8JnslrSs= X-Received: by 2002:a19:4344:: with SMTP id m4-v6mr3231065lfj.111.1531432375084; Thu, 12 Jul 2018 14:52:55 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id p24-v6sm3537223lje.0.2018.07.12.14.52.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Jul 2018 14:52:54 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Fri, 13 Jul 2018 00:52:51 +0300 Message-Id: <20180712215253.4290-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.18.0 Cc: Tom Rini Subject: [U-Boot] [PATCH 1/3] dfu: Fix data abort in dfu_free_entities() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In case of error in dfu_config_entities(), it frees "dfu" array, which leads to "data abort" in dfu_free_entities(), which tries to free the same array (and even tries to access it from linked list first). The issue occurs e.g. when partition table on device does not match $dfu_alt_info layout: => dfu 0 mmc 1 list Couldn't find part #2 on mmc device #1 DFU entities configuration failed! data abort To fix this issue, do not free "dfu" array in dfu_config_entities(). It will be freed later in dfu_free_entities(). Signed-off-by: Sam Protsenko Acked-by: Lukasz Majewski --- drivers/dfu/dfu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index e7c91193b9..a3c09334b7 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -462,7 +462,7 @@ int dfu_config_entities(char *env, char *interface, char *devstr) ret = dfu_fill_entity(&dfu[i], s, alt_num_cnt, interface, devstr); if (ret) { - free(dfu); + /* We will free "dfu" in dfu_free_entities() */ return -1; }