lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230218005356.3932-1-zeming@nfschina.com>
Date:   Sat, 18 Feb 2023 08:53:56 +0800
From:   Li zeming <zeming@...china.com>
To:     mst@...hat.com, jasowang@...hat.com, pbonzini@...hat.com,
        stefanha@...hat.com, jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc:     virtualization@...ts.linux-foundation.org,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Li zeming <zeming@...china.com>
Subject: [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag

The inq_result pointer must be allocated successfully; otherwise,
subsequent function execution may crash.

Signed-off-by: Li zeming <zeming@...china.com>
---
 drivers/scsi/virtio_scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index d07d24c06b54..3252f4b42261 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -336,7 +336,7 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)
 	struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev);
 	unsigned char scsi_cmd[MAX_COMMAND_SIZE];
 	int result, inquiry_len, inq_result_len = 256;
-	char *inq_result = kmalloc(inq_result_len, GFP_KERNEL);
+	char *inq_result = kmalloc(inq_result_len, __GFP_NOFAIL);
 
 	shost_for_each_device(sdev, shost) {
 		inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;
-- 
2.18.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ