From nobody Wed Oct 22 15:57:35 2025 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE8392737E7 for ; Tue, 21 Oct 2025 19:54:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761076464; cv=none; b=C6wqc2T+PKbprvulWVrcIHi3gxIdsnCw4vo25BmYFk7TdmS8sKk3jJOccUq02ZouDWNpTH+95//H+1RovUKpcam5lvknhOvSHy3VXR6YS1OlRVWt5vIfZ9SOvphC6tWyxxVRnLR8/6JIbqkz3fYCUq3wwYbEj3lokxYgce++mJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761076464; c=relaxed/simple; bh=P6gOTDuxOa/YTaF/r+9WBSdmbFeLRsp1krHSzNxYKmo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YXDuvOQpAjklaJ5ZbnkVX6h3aOzmlf4EwDzrxIEntcMO8jL+d5eb/6oMyWP7MpeUCflOT1EZj9swo1dAblfx9dE/hNQk974GCWjg0qbUXEkjq4RSgqaOKkpXb7QuKopXcz1aAiEZXZ95d4cjyIC6Kw7cgJ7tfU3Mt5mJmHJGNRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ssn.edu.in; spf=pass smtp.mailfrom=ssn.edu.in; dkim=pass (1024-bit key) header.d=ssn.edu.in header.i=@ssn.edu.in header.b=PdhDctOW; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ssn.edu.in Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ssn.edu.in Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ssn.edu.in header.i=@ssn.edu.in header.b="PdhDctOW" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-b67684e2904so4285680a12.2 for ; Tue, 21 Oct 2025 12:54:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ssn.edu.in; s=ssn; t=1761076460; x=1761681260; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=AcFoefsaPjLXkyzo6zOvLiCXIAfemQ8FPLpQYhQcMBA=; b=PdhDctOW7LHTQOimwSD41mYdY6sAt+KdYPQZ+9z1mFn+kdzilygT49LPQOdBHJCT5F 2x5ayXsJr7fzjnso4OEv7wIr2BJdCYCgD6McRk/u8Ye2JpG/ZpV7Q1EG7tZKhFahL38m f4HTyLdufSA/gJ9odLJz0lbtW3QGKBZN6npeg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761076460; x=1761681260; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=AcFoefsaPjLXkyzo6zOvLiCXIAfemQ8FPLpQYhQcMBA=; b=v2T5kr5wgsvqw6sfzlX3S5BD6BD0GhNTGkfr1WWhDN+vxGa/1cnBtDL09Yrh8fJaAt 7xhFosv6weuQDWLYF2J6EaYAN3pUMlxtuV3s0rqLGEOXf/ee7CgCuqreuU+RzDfSH4Zg /cqZRvTdn5nqe1zVYsny4Gc+7Mnd68597qr3JCJ8Y2v+4CYvPzu7Eg6uQX3JixTZ686R 9Atg5e7gNzqYyXcS0rIuaibw/AzbbRVHccBFeSCm3jA50N72xzfkpJuM0qsZnfnYsEQm DgyfpMr9Bb0dgQSMvZR5bQglAuspuwlMkgTyGBGPT6PHaZB0Z823sj14GkczGjhzyv5z 0RLg== X-Forwarded-Encrypted: i=1; AJvYcCWYKUgsOHR/jX34b2RjFxN3Tduetbl1UtCsHny5apK/LMU4EKgo5gviF2YrUFuSfoueH79TSgjZBkvWB7s=@vger.kernel.org X-Gm-Message-State: AOJu0YzcJj4EW8nfcJWUN8EFExicVZDq3fA3FNFkhh2PNOIWfdimmQPx Hp7kjifBnJQUv9Wm/7mq8AzPg196NHzsmgwzneeETEdN0YR6nwcoOKzPX6WOmQBgMeE1iQr42Om /9H1so5S6YfKWyV9cL6MzPzpe5odd+zhIQHrR/kgg7hXhHU/DgbU2OC/n X-Gm-Gg: ASbGncu+aUOS9QZsgz0I4dyAY5h8QTMUpHpeE3XpWU7pB47Pz0l2Cu6M2EMNjzwxBT9 CKA+wo4RA9Os/fwTdTWphtbVGETJNoj7Yxask5SEAizHSR3AutNMFAMHAkNbhP6v/S93JXsVPpS cdyekYxRxU0T/kncFRNm9wUQM+dCCW/HaSJUe0t4+WyyqF2esCev5FQB0UHeADTnagaZL2xvKAO cfFr5XQIU5MFT8aq7P/Uz7ou8pKPtCReZPstmHaxn/PBDLo+7u578pTwrTEbOIKElk5gLUcrOwd 853U6r8I457fvJvHfG4XyvxwzUpsdMIpbThL7wBPnwzsuFsW6N9fr7kKNYp0KQKF8hvZZIYfUhw helTQviTuw5yOqyXT+giaV4n8SUuhd/2uiH6V9f7LX9Vk1sapr6InlSlvqEyzzeEwTCh/e9j/rD DtKtwetP/TE2azYwhaHV3N8nokKrdZfuUjzIfgJbhhMue5A7tzcGK51F/5f9YHsgautBgGY15+7 RWwDjcUdu43phWIG1+rcXXP9w== X-Google-Smtp-Source: AGHT+IHdqPILmI5njIqVDpKBmLui9usuOxoUPpD/nquNAJpzxuM5S7Wu7+rKnfoB/re6af/wm8VuZw== X-Received: by 2002:a17:903:1746:b0:290:9ebf:211b with SMTP id d9443c01a7336-290cb07d223mr220000405ad.40.1761076459335; Tue, 21 Oct 2025 12:54:19 -0700 (PDT) Received: from biancaa-HP-Pavilion-Laptop-15-eg2xxx.. ([2406:7400:1c3:33f3:d5f3:33d1:a1e0:46bc]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-292471fddfesm116662155ad.88.2025.10.21.12.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Oct 2025 12:54:19 -0700 (PDT) From: Biancaa Ramesh To: linux-media@vger.kernel.org Cc: awalls@md.metrocast.net, mchehab@kernel.org, linux-kernel@vger.kernel.org, Biancaa Ramesh Subject: [PATCH] kernel memory safety check in a block Date: Wed, 22 Oct 2025 01:24:12 +0530 Message-ID: <20251021195412.176771-1-biancaa2210329@ssn.edu.in> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Biancaa Ramesh --- drivers/media/pci/cx18/cx18-queue.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-queue.c b/drivers/media/pci/cx18/c= x18-queue.c index eeb5513b1d52..025ba4e6e4be 100644 --- a/drivers/media/pci/cx18/cx18-queue.c +++ b/drivers/media/pci/cx18/cx18-queue.c @@ -383,9 +383,16 @@ int cx18_stream_alloc(struct cx18_stream *s) buf->buf, s->buf_size, s->dma); if (dma_mapping_error(&s->cx->pci_dev->dev, buf->dma_handle)) { - kfree(buf->buf); + if (buf) { + if (buf->buf){ + kfree(buf->buf); + buf->buf =3DNULL; + } + kfree(buf); + buf=3DNULL; + } kfree(mdl); - kfree(buf); + //makes accidental double free less possible break; } =20 --=20 2.43.0 --=20 ::DISCLAIMER:: --------------------------------------------------------------------- The=20 contents of this e-mail and any attachment(s) are confidential and intended=20 for the named recipient(s) only. Views or opinions, if any, presented in=20 this email are solely those of the author and may not necessarily reflect=20 the views or opinions of SSN Institutions (SSN) or its affiliates. Any form=20 of reproduction, dissemination, copying, disclosure, modification,=20 distribution and / or publication of this message without the prior written=20 consent of authorized representative of SSN is strictly prohibited. If you=20 have received this email in error please delete it and notify the sender=20 immediately. --------------------------------------------------------------------- Header of this mail should have a valid DKIM signature for the domain=20 ssn.edu.in