Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2976196pxb; Tue, 19 Jan 2021 10:23:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNuyY+5N3h4i8v/vbI1r/LJ1p1jLjYt47P0FWaf3ON6Js9x+JpTXcWNjiW/PAYm9IUcfnl X-Received: by 2002:aa7:d148:: with SMTP id r8mr4417058edo.127.1611080628711; Tue, 19 Jan 2021 10:23:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611080628; cv=none; d=google.com; s=arc-20160816; b=PKyeOIIJSk04TIr8L8/yoNPFQwORiIorf8ZYIcHWE2npwWmqV1Wo7OOW7yoEZDJENe L4N5Y+xgHOY24N4ak7oqen3fCovkwI/L2je88DbrNoipcEuHmt6eDC3vm2B6QQqTJvcs cLzrDhffsMg0HfRh/3Xr7yDTmad76JpM33V1Au7NSFECkPJ3NnJCUupJsWsyR6iPqyd3 /5+Zsy1eV6fYLVgnTC9dfn+szor/VOJR8rI4gkM/N11d44+5BwmBNKp5xcM0Kayw0UaD uhPx1JSpDNvhz6n0vToMz0tZ+USpR2IepYdKcQw4f5HOQJGfTHXXyKmK05bf9Cxd90EN nQJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=Ji13liyFDC2lDH5ciCyuoxMctj4vQjl6Y6p/lptZcMQ=; b=n18jFC0pGOz3MUVztodj7EKMgxfCOCRUPaZJuU7/pMdClejbtlmBzDdJyn1U9wlzp+ TynkPOeqUbwVn1MKQFf1bA6Mnb3YAQybPM6nSBWJGu6qCjR1J67fPd+TvM8++4jm75/d bkzCfApzngpVV2BvCA8ZU+cm97+kK2mDCN8oOsENFFlJSk8uTiY1FBkxNefk4naonLur MYDMtpvBquE36gywSwhy3xtPqqc2aBYO5BZKSAQ+KaxktN7ZZEquQjQtw5UrQiXcBs5f 11Av+UimkRQnBgGYOON8KpLd3Vi7DkaxoRLFVe7QQrOM+oy7UhIebZQ6lLhXOs5g53Xb Yjqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=KahbDg6Q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw17si8228959ejb.331.2021.01.19.10.23.25; Tue, 19 Jan 2021 10:23:48 -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=@google.com header.s=20161025 header.b=KahbDg6Q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404372AbhASSVO (ORCPT + 99 others); Tue, 19 Jan 2021 13:21:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392581AbhASSUf (ORCPT ); Tue, 19 Jan 2021 13:20:35 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C48CC0613D6 for ; Tue, 19 Jan 2021 10:19:49 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id n76so26223277ybg.7 for ; Tue, 19 Jan 2021 10:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=Ji13liyFDC2lDH5ciCyuoxMctj4vQjl6Y6p/lptZcMQ=; b=KahbDg6Qmg7cuIzxVxouSdEQoqwS8E49utrQBHjwJDxSY8Iu9EjXH0WOhgA+XsUrDb Q7622J51yBTUUqrn9mhnU+iA/59S00GXUNotCI4ejenbqihvLLuQSx5SwvbWykTLAe6O AD8c7jm41fKNEjJnJ1jPujUCA41yV+OZSQYj/uXdhzdlz73gs3bH8lh1kKAcD4YhHr/t ZLcTk3rNp3kNPgqrTo9qbyXgfLhXpd681hviEKtBzGt3HWUKwke0RjrVpyYI/pMZcMpr Y364NdVt87H8GtQ7qfZxowR0DZ3J3MvWQYBtV1m7ybGJzW86/XzzEalDe6THYlbQ6HUn sQnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=Ji13liyFDC2lDH5ciCyuoxMctj4vQjl6Y6p/lptZcMQ=; b=tRi9KBx71WhgRrUpStgp+weYf0uX00A5AbQH3Hm0BLsyFm0LzrRnE0V15xFmswlPXt 6bOasJBGcqEmqSciSqJuCQT1Z9ks6jRHdtrhsU+j4+tNOfoA/3WRQY+3IkPJzCmJdenl Mu41OERgZGzhD9gpFCZg3iHcI6mTpAQLDKwRtAvNURSiH+KhS7z4p8ONtp3GMdT8rVYJ iqDJpaPmjjNhtTCUU6Jf2+anFoAdiOvSsPC/BZxmmSZSBkJNiI1Sow7/L+EZUcLx1lPQ WAWLWagCaHC2jPe+bkTVdf4MMstKyxHzLFvaeOXOPgqqioJOoca+mpCNm+Sin5QnB+t/ pgjg== X-Gm-Message-State: AOAM530wvH4K5v0xBAb9RQIHkSQnZGYhng5Lx2z8tlQUOpAq7u+W8tL/ d5Tt5AgZaZtdChQgVVxdDDBuUF1fvO0M67XW5fU= Sender: "paullawrence via sendgmr" X-Received: from paullawrence.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:2534]) (user=paullawrence job=sendgmr) by 2002:a25:9706:: with SMTP id d6mr7695305ybo.211.1611080388823; Tue, 19 Jan 2021 10:19:48 -0800 (PST) Date: Tue, 19 Jan 2021 18:19:45 +0000 Message-Id: <20210119181945.2071053-1-paullawrence@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.0.284.gd98b1dd5eaa7-goog Subject: [PATCH] um: ubd: Fix crash from option parsing From: Paul Lawrence To: Jeff Dike , Richard Weinberger , Anton Ivanov , Gabriel Krisman Bertazi , Christopher Obbard , Paul Lawrence Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Below patch will cause NULL ptr dereferences if the optional filenames are not present. Fixes: ef3ba87cb7c9 (um: ubd: Set device serial attribute from cmdline) Signed-off-by: Paul Lawrence --- arch/um/drivers/ubd_kern.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 13b1fe694b90..704989088f28 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -371,15 +371,15 @@ static int ubd_setup_common(char *str, int *index_out, char **error_out) break_loop: file = strsep(&str, ",:"); - if (*file == '\0') + if (file && *file == '\0') file = NULL; backing_file = strsep(&str, ",:"); - if (*backing_file == '\0') + if (backing_file && *backing_file == '\0') backing_file = NULL; serial = strsep(&str, ",:"); - if (*serial == '\0') + if (serial && *serial == '\0') serial = NULL; if (backing_file && ubd_dev->no_cow) { -- 2.30.0.284.gd98b1dd5eaa7-goog