Re: [PATCH 04/11] iscsi: make all iSCSI netlink multicast namespace aware

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/6/23 4:29 PM, Chris Leech wrote:
> @@ -2857,11 +2859,17 @@ void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport,
>  			   enum iscsi_host_event_code code, uint32_t data_size,
>  			   uint8_t *data)
>  {
> +	struct Scsi_Host *shost;
> +	struct net *net;
>  	struct nlmsghdr *nlh;
>  	struct sk_buff *skb;
>  	struct iscsi_uevent *ev;
>  	int len = nlmsg_total_size(sizeof(*ev) + data_size);
>  
> +	shost = scsi_host_lookup(host_no);
> +	if (!shost)
> +		return;
> +
>  	skb = alloc_skb(len, GFP_NOIO);
>  	if (!skb) {

Need scsi_host_put. Maybe just grab the net and do the put before the alloc_skb.


>  		printk(KERN_ERR "gracefully ignored host event (%d):%d OOM\n",
> @@ -2880,7 +2888,9 @@ void iscsi_post_host_event(uint32_t host_no, struct iscsi_transport *transport,
>  	if (data_size)
>  		memcpy((char *)ev + sizeof(*ev), data, data_size);
>  
> -	iscsi_multicast_skb(skb, ISCSI_NL_GRP_ISCSID, GFP_NOIO);
> +	net = iscsi_host_net(shost->shost_data);
> +	scsi_host_put(shost);
> +	iscsi_multicast_skb(net, skb, ISCSI_NL_GRP_ISCSID, GFP_NOIO);
>  }
>  EXPORT_SYMBOL_GPL(iscsi_post_host_event);
>  
> @@ -2888,11 +2898,17 @@ void iscsi_ping_comp_event(uint32_t host_no, struct iscsi_transport *transport,
>  			   uint32_t status, uint32_t pid, uint32_t data_size,
>  			   uint8_t *data)
>  {
> +	struct Scsi_Host *shost;
> +	struct net *net;
>  	struct nlmsghdr *nlh;
>  	struct sk_buff *skb;
>  	struct iscsi_uevent *ev;
>  	int len = nlmsg_total_size(sizeof(*ev) + data_size);
>  
> +	shost = scsi_host_lookup(host_no);
> +	if (!shost)
> +		return;
> +
>  	skb = alloc_skb(len, GFP_NOIO);
>  	if (!skb) {

Same as above.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux