patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev,
	Vladimir Telezhnikov <vtelezhnikov@astralinux.ru>,
	Alexandra Diupina <adiupina@astralinux.ru>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 5.4 35/39] scsi: 53c700: Check that command slot is not NULL
Date: Sun, 13 Aug 2023 23:20:26 +0200	[thread overview]
Message-ID: <20230813211705.998024928@linuxfoundation.org> (raw)
In-Reply-To: <20230813211704.796906808@linuxfoundation.org>

From: Alexandra Diupina <adiupina@astralinux.ru>

commit 8366d1f1249a0d0bba41d0bd1298d63e5d34c7f7 upstream.

Add a check for the command slot value to avoid dereferencing a NULL
pointer.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Co-developed-by: Vladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: Vladimir Telezhnikov <vtelezhnikov@astralinux.ru>
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Link: https://lore.kernel.org/r/20230728123521.18293-1-adiupina@astralinux.ru
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/53c700.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1581,7 +1581,7 @@ NCR_700_intr(int irq, void *dev_id)
 				printk("scsi%d (%d:%d) PHASE MISMATCH IN SEND MESSAGE %d remain, return %p[%04x], phase %s\n", host->host_no, pun, lun, count, (void *)temp, temp - hostdata->pScript, sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
 #endif
 				resume_offset = hostdata->pScript + Ent_SendMessagePhaseMismatch;
-			} else if(dsp >= to32bit(&slot->pSG[0].ins) &&
+			} else if (slot && dsp >= to32bit(&slot->pSG[0].ins) &&
 				  dsp <= to32bit(&slot->pSG[NCR_700_SG_SEGMENTS].ins)) {
 				int data_transfer = NCR_700_readl(host, DBC_REG) & 0xffffff;
 				int SGcount = (dsp - to32bit(&slot->pSG[0].ins))/sizeof(struct NCR_700_SG_List);



  parent reply	other threads:[~2023-08-13 21:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 21:19 [PATCH 5.4 00/39] 5.4.254-rc1 review Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 01/39] mmc: moxart: read scr register without changing byte order Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 02/39] ipv6: adjust ndisc_is_useropt() to also return true for PIO Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 03/39] dmaengine: pl330: Return DMA_PAUSED when transaction is paused Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 04/39] drm/nouveau/gr: enable memory loads on helper invocation on all channels Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 05/39] radix tree test suite: fix incorrect allocation size for pthreads Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 06/39] x86/pkeys: Revert a5eff7259790 ("x86/pkeys: Add PKRU value to init_fpstate") Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 07/39] nilfs2: fix use-after-free of nilfs_root in dirtying inodes via iput Greg Kroah-Hartman
2023-08-13 21:19 ` [PATCH 5.4 08/39] iio: cros_ec: Fix the allocation size for cros_ec_command Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 09/39] binder: fix memory leak in binder_init() Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 10/39] usb-storage: alauda: Fix uninit-value in alauda_check_media() Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 11/39] usb: dwc3: Properly handle processing of pending events Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 12/39] usb: common: usb-conn-gpio: Prevent bailing out if initial role is none Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 13/39] x86/cpu/amd: Enable Zenbleed fix for AMD Custom APU 0405 Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 14/39] x86/mm: Fix VDSO and VVAR placement on 5-level paging machines Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 15/39] x86: Move gds_ucode_mitigated() declaration to header Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 16/39] drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 17/39] selftests/rseq: Fix build with undefined __weak Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 18/39] mISDN: Update parameter type of dsp_cmx_send() Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 19/39] net/packet: annotate data-races around tp->status Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 20/39] bonding: Fix incorrect deletion of ETH_P_8021AD protocol vid from slaves Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 21/39] dccp: fix data-race around dp->dccps_mss_cache Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 22/39] drivers: net: prevent tun_build_skb() to exceed the packet size limit Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 23/39] IB/hfi1: Fix possible panic during hotplug remove Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 24/39] wifi: cfg80211: fix sband iftype data lookup for AP_VLAN Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 25/39] dmaengine: mcf-edma: Fix a potential un-allocated memory access Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 26/39] net/mlx5: Allow 0 for total host VFs Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 27/39] ibmvnic: Handle DMA unmapping of login buffs in release functions Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 28/39] btrfs: dont stop integrity writeback too early Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 29/39] btrfs: set cache_block_group_error if we find an error Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 30/39] nvme-tcp: fix potential unbalanced freeze & unfreeze Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 31/39] nvme-rdma: " Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 32/39] netfilter: nf_tables: report use refcount overflow Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 33/39] scsi: core: Fix legacy /proc parsing buffer overflow Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 34/39] scsi: storvsc: Fix handling of virtual Fibre Channel timeouts Greg Kroah-Hartman
2023-08-13 21:20 ` Greg Kroah-Hartman [this message]
2023-08-13 21:20 ` [PATCH 5.4 36/39] scsi: snic: Fix possible memory leak if device_add() fails Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 37/39] scsi: core: " Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 38/39] alpha: remove __init annotation from exported page_is_ram() Greg Kroah-Hartman
2023-08-13 21:20 ` [PATCH 5.4 39/39] sch_netem: fix issues in netem_change() vs get_dist_table() Greg Kroah-Hartman
2023-08-14 14:53 ` [PATCH 5.4 00/39] 5.4.254-rc1 review Thierry Reding
2023-08-14 18:23 ` Guenter Roeck
2023-08-15  0:58 ` Shuah Khan
2023-08-15  1:43 ` Harshit Mogalapalli
2023-08-15  3:02 ` Florian Fainelli
2023-08-15  5:50 ` Daniel Díaz
2023-08-16  2:11 ` luomeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230813211705.998024928@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=adiupina@astralinux.ru \
    --cc=martin.petersen@oracle.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=vtelezhnikov@astralinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).